Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
expenses
Create expense
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/expenses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "external_id": "exp-001",
  "paid_at": "2025-01-01T01:46:59.309329Z",
  "vendor_external_id": "Office Depot",
  "reference_number": "EXP-001",
  "memo": "Office supplies",
  "line_items": [
    {
      "account_identifier": {
        "type": "StableName",
        "stable_name": "OTHER_OFFICE_EXPENSES"
      },
      "description": "Paper",
      "product_name": "Copy paper",
      "unit_price": 1001,
      "quantity": 1.5
    }
  ],
  "payment": {
    "method": "CHECK"
  }
}
'
{
  "data": {
    "type": "Bill",
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "<string>",
    "received_at": "2023-11-07T05:31:56Z",
    "due_at": "2023-11-07T05:31:56Z",
    "paid_at": "2023-11-07T05:31:56Z",
    "voided_at": "2023-11-07T05:31:56Z",
    "memo": "<string>",
    "line_items": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "external_id": "<string>",
        "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "account_identifier": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "ledger_account": {
          "type": "Single_Chart_Account",
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Current Assets",
          "account_number": "4000",
          "stable_name": {
            "type": "StableName",
            "stable_name": "CURRENT_ASSETS"
          },
          "account_type": {
            "display_name": "Asset"
          },
          "account_subtype": {
            "display_name": "Current Assets"
          }
        },
        "prepayment_account": {
          "type": "Single_Chart_Account",
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Current Assets",
          "account_number": "4000",
          "stable_name": {
            "type": "StableName",
            "stable_name": "CURRENT_ASSETS"
          },
          "account_type": {
            "display_name": "Asset"
          },
          "account_subtype": {
            "display_name": "Current Assets"
          }
        },
        "description": "<string>",
        "product_name": "<string>",
        "unit_price": 123,
        "quantity": 123,
        "subtotal": 123,
        "discount_amount": 123,
        "sales_taxes": [
          {
            "tax_account": {
              "name": "CALIFORNIA_VAT",
              "type": "Tax_Name"
            },
            "tax_ledger_account": {
              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
              "name": "Sales tax: CALIFORNIA",
              "stable_name": "SALES_TAXES:CALIFORNIA",
              "normality": "CREDIT",
              "account_type": {
                "value": "EXPENSE",
                "display_name": "Expenses"
              },
              "account_subtype": {
                "value": "SALES_TAXES",
                "display_name": "Sales Taxes"
              }
            },
            "amount": 123
          }
        ],
        "sales_taxes_total": 123,
        "total_amount": 123,
        "transaction_tags": [
          {
            "key": "department",
            "value": "sales",
            "dimension_display_name": "Department",
            "value_display_name": "Sales Department"
          }
        ],
        "memo": "<string>",
        "metadata": {
          "custom_field": "value",
          "any valid json": "below 1kb",
          "nested": {
            "meaning of life": 42,
            "array": []
          }
        },
        "reference_number": "<string>"
      }
    ],
    "additional_sales_taxes": [
      {
        "tax_account": {
          "name": "CALIFORNIA_VAT",
          "type": "Tax_Name"
        },
        "tax_ledger_account": {
          "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
          "name": "Sales tax: CALIFORNIA",
          "stable_name": "SALES_TAXES:CALIFORNIA",
          "normality": "CREDIT",
          "account_type": {
            "value": "EXPENSE",
            "display_name": "Expenses"
          },
          "account_subtype": {
            "value": "SALES_TAXES",
            "display_name": "Sales Taxes"
          }
        },
        "amount": 123
      }
    ],
    "additional_sales_taxes_total": 123,
    "additional_discount": 123,
    "subtotal": 123,
    "total_amount": 123,
    "outstanding_balance": 123,
    "payment_allocations": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123,
        "payment": {
          "type": "com.layerfi.routers.ApiBillPayment",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "external_id": "<string>",
          "vendor": {
            "type": "VendorData",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "external_id": "<string>",
            "individual_name": "<string>",
            "company_name": "<string>",
            "email": "<string>",
            "mobile_phone": "<string>",
            "office_phone": "<string>",
            "address_string": "<string>",
            "memo": "<string>",
            "transaction_tags": [
              {
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "key": "ExampleTagKey",
                "value": "ExampleTagValue",
                "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "dimension_display_name": "<string>",
                "value_display_name": "<string>",
                "archived_at": "2023-11-07T05:31:56Z"
              }
            ]
          },
          "at": "2023-11-07T05:31:56Z",
          "amount": 123,
          "processor": "<string>",
          "payment_clearing_account": {
            "type": "Single_Chart_Account",
            "id": {
              "type": "AccountId",
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            },
            "name": "Current Assets",
            "account_number": "4000",
            "stable_name": {
              "type": "StableName",
              "stable_name": "CURRENT_ASSETS"
            },
            "account_type": {
              "display_name": "Asset"
            },
            "account_subtype": {
              "display_name": "Current Assets"
            }
          },
          "imported_at": "2023-11-07T05:31:56Z",
          "allocations": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "amount": 123,
              "transaction_tags": [
                {
                  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "key": "ExampleTagKey",
                  "value": "ExampleTagValue",
                  "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "dimension_display_name": "<string>",
                  "value_display_name": "<string>",
                  "archived_at": "2023-11-07T05:31:56Z"
                }
              ],
              "memo": "<string>",
              "metadata": {
                "custom_field": "value",
                "any valid json": "below 1kb",
                "nested": {
                  "meaning of life": 42,
                  "array": []
                }
              },
              "reference_number": "<string>"
            }
          ],
          "transaction_tags": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "key": "ExampleTagKey",
              "value": "ExampleTagValue",
              "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "dimension_display_name": "<string>",
              "value_display_name": "<string>",
              "archived_at": "2023-11-07T05:31:56Z"
            }
          ],
          "memo": "<string>",
          "metadata": {
            "custom_field": "value",
            "any valid json": "below 1kb",
            "nested": {
              "meaning of life": 42,
              "array": []
            }
          },
          "reference_number": "<string>"
        },
        "transaction_tags": [
          {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "key": "ExampleTagKey",
            "value": "ExampleTagValue",
            "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "dimension_display_name": "<string>",
            "value_display_name": "<string>",
            "archived_at": "2023-11-07T05:31:56Z"
          }
        ],
        "memo": "<string>",
        "metadata": {
          "custom_field": "value",
          "any valid json": "below 1kb",
          "nested": {
            "meaning of life": 42,
            "array": []
          }
        },
        "reference_number": "<string>"
      }
    ],
    "vendor_credits": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "vendor_credit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123,
        "vendor_credit": {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "vendor": {
            "type": "VendorData",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "external_id": "<string>",
            "individual_name": "<string>",
            "company_name": "<string>",
            "email": "<string>",
            "mobile_phone": "<string>",
            "office_phone": "<string>",
            "address_string": "<string>",
            "memo": "<string>",
            "transaction_tags": [
              {
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "key": "ExampleTagKey",
                "value": "ExampleTagValue",
                "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "dimension_display_name": "<string>",
                "value_display_name": "<string>",
                "archived_at": "2023-11-07T05:31:56Z"
              }
            ]
          },
          "received_at": "2023-11-07T05:31:56Z",
          "line_items": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "amount": 123,
              "ledger_account": {
                "type": "Single_Chart_Account",
                "id": {
                  "type": "AccountId",
                  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                },
                "name": "Current Assets",
                "account_number": "4000",
                "stable_name": {
                  "type": "StableName",
                  "stable_name": "CURRENT_ASSETS"
                },
                "account_type": {
                  "display_name": "Asset"
                },
                "account_subtype": {
                  "display_name": "Current Assets"
                }
              },
              "memo": "<string>",
              "metadata": {
                "custom_field": "value",
                "any valid json": "below 1kb",
                "nested": {
                  "meaning of life": 42,
                  "array": []
                }
              },
              "reference_number": "<string>",
              "transaction_tags": [
                {
                  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "key": "ExampleTagKey",
                  "value": "ExampleTagValue",
                  "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                  "dimension_display_name": "<string>",
                  "value_display_name": "<string>",
                  "archived_at": "2023-11-07T05:31:56Z"
                }
              ]
            }
          ],
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "transaction_tags": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "key": "ExampleTagKey",
              "value": "ExampleTagValue",
              "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "dimension_display_name": "<string>",
              "value_display_name": "<string>",
              "archived_at": "2023-11-07T05:31:56Z"
            }
          ],
          "type": "Vendor_Credit",
          "external_id": "<string>",
          "allocations": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "vendor_credit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "amount": 123,
              "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            }
          ],
          "deleted_at": "2023-11-07T05:31:56Z",
          "memo": "<string>",
          "metadata": {
            "custom_field": "value",
            "any valid json": "below 1kb",
            "nested": {
              "meaning of life": 42,
              "array": []
            }
          },
          "reference_number": "<string>"
        },
        "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      }
    ],
    "imported_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "vendor": {
      "type": "VendorData",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "external_id": "<string>",
      "individual_name": "<string>",
      "company_name": "<string>",
      "email": "<string>",
      "mobile_phone": "<string>",
      "office_phone": "<string>",
      "address_string": "<string>",
      "memo": "<string>",
      "transaction_tags": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "key": "ExampleTagKey",
          "value": "ExampleTagValue",
          "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "dimension_display_name": "<string>",
          "value_display_name": "<string>",
          "archived_at": "2023-11-07T05:31:56Z"
        }
      ]
    },
    "transaction_tags": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "key": "ExampleTagKey",
        "value": "ExampleTagValue",
        "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dimension_display_name": "<string>",
        "value_display_name": "<string>",
        "archived_at": "2023-11-07T05:31:56Z"
      }
    ],
    "is_expense": true,
    "metadata": {
      "custom_field": "value",
      "any valid json": "below 1kb",
      "nested": {
        "meaning of life": 42,
        "array": []
      }
    },
    "reference_number": "<string>"
  }
}
Create an expense when a purchase and payment happen at the same time. An expense is a type of bill with is_expense: true and status: PAID. Use this endpoint to submit the vendor, line items, purchase date, and payment details in one request. The request is idempotent via external_id; if an expense with the same external_id already exists, Layer returns the existing expense with a 200 response. Required fields to plan for:
  • paid_at: when the purchase was paid
  • line_items: what was purchased
  • payment: how it was paid
  • vendor_id or vendor_external_id: who was paid
Line items use the same shape as Create bill. See the Expense object for when to use expenses instead of standard bills.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

businessId
string<uuid>
required

The UUID of the business to create the expense for.

Body

application/json
paid_at
string<date-time>
required

When the purchase was paid.

line_items
object[]
required

Line items for the purchase. Uses the same line item shape as Create bill.

payment
object
required

Payment details for the expense. Expenses are created in PAID status with a payment for the full amount.

external_id
string | null

Unique ID of the expense in your system. Used for linking and idempotency. If an expense with the same external_id already exists, Layer returns the existing expense.

vendor_id
string<uuid>

Layer vendor ID. Either vendor_id or vendor_external_id must be provided.

vendor_external_id
string

Vendor external ID in your system. Either vendor_id or vendor_external_id must be provided.

reference_number
string | null

Any (typically user-visible) identifier for the expense.

memo
string | null

Memo for the expense.

additional_sales_taxes
object[]

Additional sales tax line items applied to the expense total.

additional_discount
integer<int64> | null
default:0

Additional discount applied to the expense total, in cents.

tags
object[] | null

Tags to associate with the expense.

metadata
object

Arbitrary custom metadata in JSON format with a size limit of 1KB.

Example:
{
"custom_field": "value",
"any valid json": "below 1kb",
"nested": { "meaning of life": 42, "array": [] }
}

Response

Existing expense returned (idempotent request with matching external_id).

data
object