{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pluggy/json-schema/pluggy-account-schema.json",
  "title": "Account",
  "description": "Account of type bank",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pluggy-account-api-openapi.yml#/components/schemas/Account",
  "properties": {
    "id": {
      "type": "string",
      "description": "Primary account identifier"
    },
    "type": {
      "enum": [
        "BANK",
        "CREDIT"
      ],
      "type": "string",
      "description": "Top-level account category.\n- `BANK`: deposit accounts (checking, savings). The `bankData` object is populated.\n- `CREDIT`: credit-card accounts. The `creditData` object is populated."
    },
    "subtype": {
      "enum": [
        "SAVINGS_ACCOUNT",
        "CHECKING_ACCOUNT",
        "CREDIT_CARD"
      ],
      "type": "string",
      "description": "Account subtype within its `type`.\n- `CHECKING_ACCOUNT`: conta corrente (`type=BANK`).\n- `SAVINGS_ACCOUNT`: conta poupança (`type=BANK`).\n- `CREDIT_CARD`: credit card account (`type=CREDIT`). For these the `number` field is masked to the last 4 digits."
    },
    "number": {
      "type": "string",
      "description": "External identifier of the account"
    },
    "name": {
      "type": "string",
      "description": "Name of the account in a descriptive format"
    },
    "marketingName": {
      "type": "string",
      "description": "Name of the account as defined externally"
    },
    "balance": {
      "type": "number",
      "format": "double",
      "description": "Funds of the account"
    },
    "itemId": {
      "type": "string",
      "description": "Attached item's primary identifier",
      "format": "uuid"
    },
    "taxNumber": {
      "type": "string",
      "description": "Tax ID of the corresponding owner"
    },
    "owner": {
      "type": "string",
      "description": "Name of the owner of the account"
    },
    "currencyCode": {
      "type": "string",
      "description": "Code referencing the currency of the balance"
    },
    "bankData": {
      "$ref": "#/$defs/BankData"
    },
    "creditData": {
      "$ref": "#/$defs/CreditData"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date when the account was first created in Pluggy"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date of the last update of the account data"
    }
  },
  "type": "object",
  "required": [
    "id",
    "type",
    "subtype",
    "number",
    "name",
    "balance",
    "itemId",
    "currencyCode",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "AdditionalCard": {
      "description": "Additional credit card data",
      "properties": {
        "number": {
          "type": "string",
          "description": "Number of the additional credit card"
        }
      },
      "type": "object",
      "required": [
        "number"
      ]
    },
    "BankData": {
      "description": "Bank account additional fields",
      "properties": {
        "transferNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Complete number of the bank account `(agency code / account number)`"
        },
        "closingBalance": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Balance including not posted transactions"
        },
        "automaticallyInvestedBalance": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Balance automatically invested in the account by the FI"
        },
        "overdraftContractedLimit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Overdraft contracted limit"
        },
        "overdraftUsedLimit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Overdraft used limit"
        },
        "unarrangedOverdraftAmount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Valor de operação contratada em caráter emergencial para cobertura de saldo devedor em conta de depósitos à vista e de excesso sobre o limite pactuado de cheque especial."
        },
        "hasReservedBalance": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether the account has any active reserved balances (\"saldo reservado\"), such as goal-based savings (\"caixinhas\") or judicial holds"
        },
        "reservedBalances": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ReservedBalance"
          },
          "description": "Funds reserved/earmarked on the account. Only present when hasReservedBalance is true and the institution exposes the data"
        }
      },
      "type": "object"
    },
    "CreditData": {
      "description": "Credit account additional fields",
      "properties": {
        "level": {
          "type": [
            "string",
            "null"
          ],
          "description": "Card level (Black, Signature)"
        },
        "brand": {
          "type": [
            "string",
            "null"
          ],
          "description": "Card Brand (Visa, Mastercard, Elo)"
        },
        "brandAdditionalInfo": {
          "type": [
            "string",
            "null"
          ],
          "description": "Free text describing the brand category when brand is 'OTHER'"
        },
        "balanceCloseDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Date when the balance was closed"
        },
        "balanceDueDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Date when the balance is dued"
        },
        "availableCreditLimit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Credit limit available to spent"
        },
        "balanceForeignCurrency": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Balance in USD"
        },
        "minimumPayment": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Minimum payment due"
        },
        "creditLimit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Maximum amount that can be spent"
        },
        "isLimitFlexible": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the credit limit can be adjusted (e.g. a customer can request an increase). Only returned when reported by the institution."
        },
        "status": {
          "enum": [
            "ACTIVE",
            "BLOCKED",
            "CANCELLED",
            null
          ],
          "type": [
            "string",
            "null"
          ],
          "description": "Credit card status"
        },
        "holderType": {
          "enum": [
            "MAIN",
            "ADDITIONAL",
            null
          ],
          "type": [
            "string",
            "null"
          ],
          "description": "Credit card holder type"
        },
        "disaggregatedCreditLimits": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/DisaggregatedCreditLimit"
          },
          "description": "Disaggregated credit card limits"
        },
        "additionalCards": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/AdditionalCard"
          },
          "description": "Additional credit cards associated with the main one"
        }
      },
      "type": "object"
    },
    "DisaggregatedCreditLimit": {
      "description": "Disaggregated credit card limit",
      "properties": {
        "creditLineLimitType": {
          "type": "string",
          "description": "Limit type (LIMITE_CREDITO_TOTAL or LIMITE_CREDITO_MODALIDADE_OPERACAO)"
        },
        "consolidationType": {
          "type": "string",
          "description": "Indicates if the limit is consolidated or individual"
        },
        "identificationNumber": {
          "type": "string",
          "description": "Identification number of the additional credit card"
        },
        "isLimitFlexible": {
          "type": "boolean",
          "description": "Indicates if the limit is flexible"
        },
        "usedAmount": {
          "type": "number",
          "format": "double",
          "description": "Used amount of the additional credit card"
        },
        "usedAmountCurrencyCode": {
          "type": "string",
          "description": "Used amount currency code (for example, BRL)"
        },
        "lineName": {
          "enum": [
            "CREDITO_A_VISTA",
            "CREDITO_PARCELADO",
            "SAQUE_CREDITO_BRASIL",
            "SAQUE_CREDITO_EXTERIOR",
            "EMPRESTIMO_CARTAO_CONSIGNADO",
            "OUTROS"
          ],
          "type": "string",
          "description": "Name of the credit limit line"
        },
        "lineNameAdditionalInfo": {
          "type": "string",
          "description": "Free text describing the line name when lineName is 'OUTROS'"
        },
        "limitAmount": {
          "type": "number",
          "format": "double",
          "description": "Limit amount of the additional credit card"
        },
        "limitAmountCurrencyCode": {
          "type": "string",
          "description": "Limit amount currency code (for example, BRL)"
        },
        "limitAmountReason": {
          "type": "string",
          "description": "Reason why the reported total limit amount is equal to zero"
        },
        "customizedLimitAmount": {
          "type": "number",
          "format": "double",
          "description": "Total limit amount customized by the customer through the institution's electronic channels"
        },
        "customizedLimitAmountCurrencyCode": {
          "type": "string",
          "description": "Customized limit amount currency code (for example, BRL)"
        },
        "availableAmount": {
          "type": "number",
          "format": "double",
          "description": "Available amount of the additional credit card"
        },
        "availableAmountCurrencyCode": {
          "type": "string",
          "description": "Available amount currency code (for example, BRL)"
        }
      },
      "type": "object",
      "required": [
        "creditLineLimitType",
        "consolidationType",
        "identificationNumber",
        "isLimitFlexible",
        "usedAmount",
        "usedAmountCurrencyCode"
      ]
    },
    "ReservedBalance": {
      "description": "Funds reserved/earmarked on a bank account (for example, goal-based savings or judicial holds)",
      "properties": {
        "name": {
          "type": "string",
          "description": "User-given name for the reservation (for example, 'Caixinha Para Férias')"
        },
        "identification": {
          "type": "string",
          "description": "Unique identifier of the reservation"
        },
        "availableAmounts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ReservedBalanceAmount"
          },
          "description": "Available amount(s) in the reservation, one entry per remuneration band"
        }
      },
      "type": "object",
      "required": [
        "identification",
        "availableAmounts"
      ]
    },
    "ReservedBalanceAmount": {
      "description": "A single amount within a reserved balance, optionally with its remuneration",
      "properties": {
        "amount": {
          "type": "number",
          "format": "double",
          "description": "Reserved amount"
        },
        "currencyCode": {
          "type": "string",
          "description": "Amount currency code (for example, BRL)"
        },
        "remuneration": {
          "$ref": "#/$defs/ReservedBalanceRemuneration"
        }
      },
      "type": "object",
      "required": [
        "amount",
        "currencyCode"
      ]
    },
    "ReservedBalanceRemuneration": {
      "description": "Remuneration applied to a reserved balance",
      "properties": {
        "preFixedRate": {
          "type": "number",
          "format": "double",
          "description": "Pre-fixed remuneration rate, as a fraction (for example, 0.3 = 30%)"
        },
        "postFixedIndexerPercentage": {
          "type": "number",
          "format": "double",
          "description": "Post-fixed indexer percentage, as a fraction (for example, 1.1 = 110% of the indexer)"
        },
        "rateType": {
          "type": "string",
          "description": "Rate type (LINEAR or EXPONENCIAL)"
        },
        "indexer": {
          "type": "string",
          "description": "Indexer used as remuneration reference (for example, CDI, IPCA, SELIC)"
        },
        "calculation": {
          "type": "string",
          "description": "Calculation basis (DIAS_UTEIS or DIAS_CORRIDOS)"
        },
        "ratePeriodicity": {
          "type": "string",
          "description": "Rate periodicity (MENSAL, ANUAL, DIARIO or SEMESTRAL)"
        },
        "indexerAdditionalInfo": {
          "type": "string",
          "description": "Additional indexer info, required when indexer is OUTROS"
        }
      },
      "type": "object"
    }
  }
}