{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/quickbooks/json-schema/quickbooks-purchaserequest-schema.json",
  "title": "purchaserequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/quickbooks-purchase-api-openapi.yml#/components/schemas/purchaserequest",
  "type": "object",
  "properties": {
    "PaymentType": {
      "type": "string",
      "description": "Payment Type can be: \nCash,\nCheck, or\nCreditCard.",
      "x-intuit-required": "Required"
    },
    "AccountRef": {
      "allOf": [
        {
          "$ref": "#/$defs/referencetype"
        }
      ],
      "description": "Specifies the account reference. Check must specify bank account, CreditCard must specify credit card account.\nValidation Rules:Valid and Active Account Reference of an appropriate type.",
      "x-intuit-required": "Required"
    },
    "CurrencyRef": {
      "type": "object",
      "x-intuit-type": "CurrencyRefType",
      "description": "Reference to the currency in which all amounts on the associated transaction are expressed. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if Preferences.MultiCurrencyEnabled is set to true. Read more about multicurrency support here. Required if multicurrency is enabled for the company",
      "x-intuit-required": "Conditionally required"
    },
    "Line": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/line"
      },
      "description": "Individual line items of a transaction. Valid\nLinetype for create: AccountBasedExpenseLine",
      "x-intuit-required": "Required"
    }
  },
  "required": [
    "AccountRef",
    "Line",
    "PaymentType"
  ],
  "$defs": {
    "line": {
      "type": "object",
      "title": "line",
      "properties": {
        "Received": {
          "type": "string",
          "description": "Supported for Purchase Order only. The amount/quantity received of the line, which depends on the type of the line. It can represent the received amount or received quantity based on the line type detail. Applies to existing and new entities."
        },
        "LinkedTxn": {
          "type": "array",
          "items": {},
          "description": "Transaction to which the current entity is related. For example, an invoice line may link to a sales order or estimate.",
          "x-intuit-required": "Optional"
        },
        "Description": {
          "type": "string",
          "description": "Free form text description of the line item that appears in the printed record.",
          "x-intuit-required": "Optional"
        },
        "ProjectRef": {
          "allOf": [
            {
              "$ref": "#/$defs/referencetype"
            }
          ],
          "description": "Reference to the Project ID associated with this transaction.",
          "x-intuit-required": "Conditionally required"
        },
        "LineNum": {
          "type": "number",
          "description": "Specifies the position of the line in the collection of transaction lines. Positive integer",
          "x-intuit-required": "Optional"
        },
        "Amount": {
          "type": "number",
          "description": "The amount of the line item.",
          "x-intuit-required": "Required"
        },
        "Id": {
          "type": "string",
          "description": "The Id of the line item. Its use in requests is as folllows:\nIf\nIdis greater than zero and exists for the company, the request is considered an update operation for a line item.\n\nIf no\nIdis provided, the\nIdprovided is less than or equal to zero, or the\nIdprovided is greater than zero and does not exist for the company then the request is considered a create operation for a line item.\n\nAvailable in all objects that use lines and support the update operation.",
          "x-intuit-required": "Required for update"
        }
      },
      "required": [
        "Amount"
      ]
    },
    "referencetype": {
      "type": "object",
      "title": "referencetype",
      "properties": {
        "name": {
          "type": "string",
          "description": "An identifying name for the object being referenced by value and is derived from the field that holds the common name of that object. This varies by context and specific type of object referenced. For example, references to a Customer object use Customer.DisplayName to populate this field. Optionally returned in responses, implementation dependent.",
          "x-intuit-required": "Optional"
        },
        "value": {
          "type": "string",
          "description": "The ID for the referenced object as found in the Id field of the object payload. The context is set by the type of reference and is specific to the QuickBooks company file.",
          "x-intuit-required": "Required"
        }
      },
      "required": [
        "value"
      ]
    }
  }
}