Codat · Schema

Accounting: Bill

> **Invoices or bills?** > > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. > > See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. ## Overview In Codat, a bill contains details of: * When the bill was recorded in the accounting system. * How much the bill is for and the currency of the amount. * Who the bill was received from — the *supplier*. * What the bill is for — the *line items*. Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model.

Unified_API
View JSON Schema on GitHub

JSON Schema

codat-accountingbill-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/AccountingBill",
  "title": "Accounting: Bill",
  "description": "> **Invoices or bills?**\n>\n> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill.\n>\n> See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills.\n\n## Overview\n\nIn Codat, a bill contains details of:\n* When the bill was recorded in the accounting system.\n* How much the bill is for and the currency of the amount.\n* Who the bill was received from \u2014 the *supplier*.\n* What the bill is for \u2014 the *line items*.\n\nSome accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*.\n\nYou can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model.",
  "type": "object",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Identifier for the bill, unique for the company in the accounting software."
        },
        "reference": {
          "type": "string",
          "nullable": true,
          "description": "User-friendly reference for the bill."
        },
        "supplierRef": {
          "$ref": "#/components/schemas/AccountingSupplier/definitions/supplierRef"
        },
        "purchaseOrderRefs": {
          "type": "array",
          "nullable": true,
          "items": {
            "title": "Purchase order Reference",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "description": "Identifier for the purchase order, unique for the company in the accounting software."
              },
              "purchaseOrderNumber": {
                "type": "string",
                "nullable": true,
                "description": "Friendly reference for the purchase order, commonly generated by the accounting software."
              }
            }
          }
        },
        "issueDate": {
          "allOf": [
            {
              "description": "Date of the bill as recorded in the accounting software."
            },
            {
              "$ref": "#/components/schemas/DateTime"
            }
          ]
        },
        "dueDate": {
          "allOf": [
            {
              "description": "Date the supplier is due to be paid."
            },
            {
              "$ref": "#/components/schemas/DateTime"
            }
          ]
        },
        "currency": {
          "$ref": "#/components/schemas/SourceAccount/properties/currency"
        },
        "currencyRate": {
          "$ref": "#/components/schemas/AccountingPaymentAllocation/definitions/paymentAllocationPayment/properties/currencyRate"
        },
        "lineItems": {
          "type": "array",
          "nullable": true,
          "description": "Array of Bill line items.",
          "items": {
            "$ref": "#/components/schemas/AccountingBill/definitions/billLineItem"
          }
        },
        "withholdingTax": {
          "type": "array",
          "nullable": true,
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "minLength": 1,
                "type": "string",
                "description": "Name assigned to withheld tax."
              },
              "amount": {
                "type": "number",
                "format": "decimal",
                "description": "Amount of tax withheld."
              }
            },
            "required": [
              "amount",
              "name"
            ]
          }
        },
        "status": {
          "$ref": "#/components/schemas/AccountingBill/definitions/billStatus"
        },
        "subTotal": {
          "type": "number",
          "format": "decimal",
          "description": "Total amount of the bill, excluding any taxes."
        },
        "taxAmount": {
          "type": "number",
          "format": "decimal",
          "description": "Amount of tax on the bill."
        },
        "totalAmount": {
          "type": "number",
          "format": "decimal",
          "description": "Amount of the bill, including tax."
        },
        "amountDue": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Amount outstanding on the bill."
        },
        "note": {
          "type": "string",
          "nullable": true,
          "description": "Any private, company notes about the bill, such as payment information."
        },
        "paymentAllocations": {
          "type": "array",
          "nullable": true,
          "description": "An array of payment allocations.",
          "items": {
            "$ref": "#/components/schemas/AccountingPaymentAllocation"
          }
        },
        "metadata": {
          "$ref": "#/components/schemas/Metadata"
        },
        "supplementalData": {
          "$ref": "#/components/schemas/SupplementalData"
        }
      }
    },
    {
      "$ref": "#/components/schemas/CommerceOrder/allOf/3"
    }
  ],
  "required": [
    "issueDate",
    "status",
    "subTotal",
    "taxAmount",
    "totalAmount"
  ],
  "definitions": {
    "billStatus": {
      "description": "Current state of the bill.",
      "type": "string",
      "enum": [
        "Unknown",
        "Open",
        "PartiallyPaid",
        "Paid",
        "Void",
        "Draft"
      ]
    },
    "billLineItem": {
      "title": "Bill line item",
      "type": "object",
      "properties": {
        "lineNumber": {
          "type": "string",
          "nullable": true,
          "description": "The bill line's number."
        },
        "description": {
          "type": "string",
          "nullable": true,
          "description": "Friendly name of the goods or services received."
        },
        "unitAmount": {
          "type": "number",
          "format": "decimal",
          "description": "Price of each unit of goods or services."
        },
        "quantity": {
          "type": "number",
          "format": "decimal",
          "description": "Number of units of goods or services received."
        },
        "unitOfMeasurement": {
          "type": "string",
          "nullable": true,
          "description": "The measurement which defines a unit for this item (e.g. 'kilogram', 'litre')."
        },
        "discountAmount": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Numerical value of any discounts applied.\n\nDo not use to apply discounts in Oracle NetSuite\u2014see Oracle NetSuite integration reference."
        },
        "subTotal": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Amount of the line, inclusive of discounts but exclusive of tax."
        },
        "taxAmount": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Amount of tax for the line."
        },
        "totalAmount": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Total amount of the line, including tax."
        },
        "discountPercentage": {
          "type": "number",
          "format": "decimal",
          "nullable": true,
          "description": "Percentage rate of any discount applied to the bill."
        },
        "accountRef": {
          "$ref": "#/components/schemas/AccountingAccount/definitions/accountRef",
          "description": "Reference to the account to which the line item is linked.",
          "nullable": true
        },
        "taxRateRef": {
          "$ref": "#/components/schemas/AccountingBillCreditNote/definitions/billCreditNoteLineItem/properties/taxRateRef",
          "description": "Reference to the tax rate to which the line item is linked."
        },
        "itemRef": {
          "$ref": "#/components/schemas/AccountingBillCreditNote/definitions/billCreditNoteLineItem/properties/itemRef",
          "description": "Reference to the product, service type, or inventory item to which the line item is linked."
        },
        "purchaseOrderLineRef": {
          "allOf": [
            {
              "type": "object",
              "x-internal": true,
              "title": "Record line reference",
              "description": "Links the current record line to the underlying record line that created it. \n\nFor example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. ",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "'id' of the underlying record."
                },
                "dataType": {
                  "type": "string",
                  "description": "Allowed name of the 'dataType'.",
                  "enum": [
                    "purchaseOrders",
                    "bills"
                  ]
                },
                "lineNumber": {
                  "type": "string",
                  "description": "Line number of the underlying record."
                }
              }
            },
            {
              "description": "Reference to the purchase order line this line was generated from."
            }
          ]
        },
        "trackingCategoryRefs": {
          "type": "array",
          "nullable": true,
          "description": "Collection of categories against which this item is tracked.",
          "items": {
            "$ref": "#/components/schemas/AccountingTrackingCategory/definitions/trackingCategoryRef"
          }
        },
        "tracking": {
          "$ref": "#/components/schemas/AccountsPayableTracking"
        },
        "isDirectCost": {
          "type": "boolean",
          "description": "The bill is a direct cost if `True`."
        }
      }
    }
  }
}