{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/doorloop/json-schema/doorloop-expense-schema.json",
  "title": "expense",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/doorloop-expenses-api-openapi.yml#/components/schemas/expense",
  "x-stoplight": {
    "id": "kznbaq3e7rwg2"
  },
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/mongoId"
    },
    "payFromAccount": {
      "type": "string"
    },
    "paymentMethod": {
      "$ref": "#/$defs/paymentMethods"
    },
    "payToResourceType": {
      "type": "string"
    },
    "payToResourceId": {
      "type": "string"
    },
    "lines": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/expenseTransactionLine"
      }
    },
    "memo": {
      "type": "string",
      "maxLength": 1000
    },
    "reference": {
      "type": "string",
      "maxLength": 255,
      "description": "If not provided will be generated automatically by the server."
    },
    "date": {
      "type": "string",
      "description": "Format: YYYY-MM-DD"
    },
    "batch": {
      "type": "string"
    },
    "totalAmount": {
      "type": "number",
      "description": "Read Only. Calculated as sum of lines.amount."
    }
  },
  "required": [
    "payFromAccount",
    "paymentMethod",
    "lines",
    "date"
  ],
  "$defs": {
    "expenseTransactionLine": {
      "title": "expenseTransactionLine",
      "x-stoplight": {
        "id": "i2oe5ol30qri6"
      },
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/mongoId"
        },
        "amount": {
          "type": "number"
        },
        "account": {
          "$ref": "#/$defs/mongoId"
        },
        "memo": {
          "type": "string",
          "maxLength": 1000
        },
        "linkedToResourceType": {
          "type": "string",
          "description": "At the monent, only \"property\" is supported",
          "enum": [
            "property"
          ]
        },
        "linkedToResourceId": {
          "type": "string",
          "description": "The Property Id for this line."
        },
        "balance": {
          "description": "Read Only",
          "type": "number"
        }
      },
      "required": [
        "account",
        "linkedToResourceType",
        "linkedToResourceId"
      ]
    },
    "mongoId": {
      "type": "string",
      "title": "mongoId",
      "x-stoplight": {
        "id": "40j7qlmpihfdj"
      },
      "pattern": "/^[a-f\\d]{24}$/i"
    },
    "paymentMethods": {
      "type": "string",
      "enum": [
        "CASH",
        "CHECK",
        "CREDIT_CARD",
        "CASHIERS_CHECK",
        "MONEY_ORDER",
        "EFT",
        "DEBIT_CARD",
        "OTHER",
        "EPAY"
      ],
      "description": "Lists all possible payment methods that can be used in payable and receivable transactions. Use EFT to record an electronic funds transfer that was collected outside DoorLoop. EPAY is reserved for payments processed through DoorLoop's own merchant account and requires a nested ePayInfo object."
    }
  }
}