Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
bills
/
bulk
Batch create bills
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/bills/bulk \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "received_at": "2023-11-07T05:31:56Z",
    "line_items": [
      {
        "product_name": "<string>",
        "unit_price": 123,
        "external_id": "<string>",
        "account_identifier": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "prepayment_account_identifier": {
          "type": "Single_Chart_Account",
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Current Assets",
          "account_number": "4000",
          "account_type": {
            "display_name": "Asset"
          },
          "account_subtype": {
            "display_name": "Current Assets"
          }
        },
        "description": "<string>",
        "quantity": 1,
        "discount_amount": 123,
        "sales_taxes": [
          {
            "amount": 123,
            "tax_account": {
              "name": "CALIFORNIA_VAT",
              "type": "Tax_Name"
            }
          }
        ],
        "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>"
      }
    ],
    "external_id": "<string>",
    "due_at": "2023-11-07T05:31:56Z",
    "additional_discount": 0,
    "memo": "<string>",
    "vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "vendor_external_id": "<string>",
    "payments": [
      {
        "amount": 123,
        "external_id": "<string>",
        "processor": "<string>",
        "payment_clearing_account_identifier": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "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": [
      {
        "amount": 123,
        "tax_account": {
          "name": "CALIFORNIA_VAT",
          "type": "Tax_Name"
        }
      }
    ],
    "tags": [
      {
        "key": "department",
        "value": "sales",
        "dimension_display_name": "Department",
        "value_display_name": "Sales Department"
      }
    ],
    "is_expense": false,
    "metadata": {
      "custom_field": "value",
      "any valid json": "below 1kb",
      "nested": {
        "meaning of life": 42,
        "array": []
      }
    },
    "reference_number": "<string>"
  }
]
'
{
  "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>",
            "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>"
    }
  ]
}

Rate Limiting

This endpoint has a custom rate limit policy. Rate Limit Details:
EnvironmentLimitRefill PeriodInitial Size
Sandbox20 requests1 second40 requests
Production20 requests1 second40 requests
Response Headers: All responses include the following rate limit headers:
  • X-RateLimit-Limit: The rate limit bucket capacity
  • X-RateLimit-Remaining: The number of tokens remaining in the bucket
  • X-RateLimit-Reset: UTC timestamp (in seconds) when the bucket will be refilled
For more details on rate limiting, see Rate Limiting.

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 bills for.

Body

application/json
received_at
string<date-time>
required

When the bill was received by the business from the vendor.

line_items
object[]
required

Line items making up the bill.

external_id
string

External ID for the bill within your platform. Idempotency key.

due_at
string<date-time>

When the bill is due. Either due_at or bill_terms must be specified, but not both.

bill_terms
enum<string>

Payment terms for the bill. Either due_at or bill_terms must be specified, but not both.

Available options:
DUE_ON_RECEIPT,
NET_10,
NET_15,
NET_30,
NET_60
additional_discount
integer<int64> | null
default:0

Additional discount applied to the whole bill in addition to individual line item discounts, in cents.

memo
string

Memo for any text you would like to associate with the bill (for example, to display to end users).

vendor_id
string<uuid>

ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified.

vendor_external_id
string

External ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified.

payments
object[] | null

Payments that have been made towards the balance of the bill. When upserting an existing bill: omitting this field (or passing null) preserves any existing dedicated payments; passing an empty array [] removes all dedicated payments. Non-dedicated payments (those independently recorded or included in a vendor payout) are never removed by this field.

additional_sales_taxes
object[]

Additional sales tax line items for the bill.

tags
object[]
is_expense
boolean
default:false

Whether the bill should be treated as an 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": [] }
}
reference_number
string | null

Any (typically user-visible) identifier you would like to associate with the bill. Can be used to filter when listing bills.

Response

201 - application/json

Bills created successfully.

data
object[]
required