{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/moneyhub/main/json-schema/moneyhub-account-post-schema.json",
  "title": "AccountPost",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/moneyhub-accounts-api-openapi.yml#/components/schemas/AccountPost",
  "properties": {
    "accountName": {
      "description": "The name of the account",
      "type": "string"
    },
    "providerName": {
      "description": "The name of the provider of the account.",
      "type": "string"
    },
    "currency": {
      "description": "The currency of the account. Defaults to GBP.",
      "type": "string"
    },
    "type": {
      "description": "The type of account - this will determine the data available in the details field",
      "enum": [
        "cash:current",
        "savings",
        "card",
        "investment",
        "loan",
        "mortgage:repayment",
        "mortgage:interestOnly",
        "pension",
        "pension:definedBenefit",
        "pension:definedContribution",
        "asset",
        "properties:residential",
        "properties:buyToLet",
        "crypto"
      ],
      "type": "string"
    },
    "accountType": {
      "description": "The type of account (personal/business)",
      "enum": [
        "personal",
        "business"
      ],
      "type": "string",
      "default": "personal"
    },
    "balance": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "amount": {
          "properties": {
            "value": {
              "description": "The value of the balance in minor units of the currency, eg. pennies for GBP.",
              "type": "integer"
            }
          },
          "required": [
            "value"
          ],
          "type": "object"
        },
        "date": {
          "description": "The date of the balance",
          "format": "date",
          "type": "string"
        }
      },
      "required": [
        "amount",
        "date"
      ]
    },
    "details": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "AER": {
          "description": "For cash and savings accounts. Interest rate expressed as a percentage 'Annual Equivalent Rate'.",
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "APR": {
          "description": "For credit cards, mortgages and loans. Interest rate expressed as a percentage 'Annual Percentage Rate'.",
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "creditLimit": {
          "description": "For credit cards. The agreed overdraft limit of the account in minor units of the currency.",
          "minimum": 0,
          "type": "integer"
        },
        "endDate": {
          "description": "For Mortgages and loans. The date at which the loan/mortgage will finish.",
          "format": "date",
          "type": "string"
        },
        "fixedDate": {
          "description": "For Mortgages. The date at which the current fixed rate ends",
          "format": "date",
          "type": "string"
        },
        "interestFreePeriod": {
          "type": "integer",
          "description": "For loans. The length in months of the interest free period",
          "minimum": 0
        },
        "interestType": {
          "description": "For mortgages. The interest type",
          "enum": [
            "fixed",
            "variable"
          ],
          "type": "string"
        },
        "linkedProperty": {
          "type": "string",
          "description": "For Mortgages. The id of an associated property account"
        },
        "monthlyRepayment": {
          "type": "integer",
          "description": "For mortgages and loans. The monthly amount due to the mortgage provider in minor units of the currency.",
          "minimum": 0
        },
        "overdraftLimit": {
          "description": "For cash accounts. The agreed overdraft limit of the account in minor units of the currency.",
          "type": "integer",
          "minimum": 0
        },
        "postcode": {
          "description": "For properties. The postcode of the property",
          "type": "string"
        },
        "runningCost": {
          "description": "For assets. The running cost in minor units of the currency.",
          "type": "integer",
          "minimum": 0
        },
        "runningCostPeriod": {
          "type": "string",
          "description": "For assets. The running cost period",
          "enum": [
            "month",
            "year"
          ]
        },
        "term": {
          "type": "integer",
          "description": "For mortgages. The term of the mortgage in months.",
          "minimum": 0
        },
        "yearlyAppreciation": {
          "type": "number",
          "description": "For assets. The rate of appreciation as a percentage, negative values indicate that the asset will depreciate"
        }
      }
    },
    "providerAccountIdentifications": {
      "type": "array",
      "description": "List of provider specific account identifications",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "identification": {
            "description": "The account identification",
            "type": "string"
          },
          "type": {
            "description": "The type of account identification",
            "type": "string",
            "enum": [
              "accountNumber",
              "savingsRollNumber",
              "policyNumber"
            ]
          }
        },
        "required": [
          "identification",
          "type"
        ]
      }
    }
  },
  "required": [
    "accountName",
    "providerName",
    "type",
    "balance"
  ],
  "type": "object"
}