{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/moneyhub/main/json-schema/moneyhub-spending-goal-post-schema.json",
  "title": "SpendingGoalPost",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/moneyhub-spending-goals-api-openapi.yml#/components/schemas/SpendingGoalPost",
  "properties": {
    "categoryId": {
      "description": "The id of the category for the spending goal, either from the /categories endpoint or **std:all**",
      "type": "string"
    },
    "periodType": {
      "description": "The period type of the goal, can be annual or monthly",
      "type": "string",
      "enum": [
        "monthly",
        "annual"
      ]
    },
    "periodStart": {
      "description": "You can set a goal period to start on a certain date. DD when periodType is monthly, DD-MM when periodType is annual",
      "type": "string",
      "pattern": "^(0?[1-9]|[12][0-9]|3[01])(-(0?[1-9]|1[012]))?$"
    },
    "amount": {
      "properties": {
        "value": {
          "description": "The amount of the spending goal in minor units of the currency, eg. pennies for GBP.",
          "type": "integer",
          "exclusiveMinimum": 0
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    }
  },
  "type": "object",
  "required": [
    "categoryId",
    "amount"
  ]
}