Skip to main content

Line Items

A Line Item represents an estimated expenditure. In Agave, Line Items are always associated with a financial objects, including AP Invoices, AR Invoices, AR Payments, Change Events, Change Orders, Estimates, Prime Contracts, Purchase Orders, and Subcontracts. Each Line Item has its own Agave-generated UUID.

Note, Line Items are different from Items. An Item is a thing that a company buys, sells, or re-sells (e.g. products, services). A Line Item can reference an Item, but not always. For example, AR Payments have Line Items, but they reference documents (e.g. Invoices), not Items.

Creating Line Items

The following is an example request that creates an AR Invoice with a Line Item. Note, most Source Systems (e.g. QuickBooks Online) require a Line Item when creating a financial object:

curl --request POST https://api.agaveapi.com/ar-invoices \
--header 'API-Version: 2021-11-21' \
--header 'Client-Id: your_client_id' \
--header 'Client-Secret: your_client_secret' \
--header 'Account-Token: account_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_id": "c840285e-e65f-4342-943f-5950ef8072dc",
"line_items": [
{
"amount": 100,
"description": "New Line Item",
"item_id": "b840285e-e65f-4342-943f-5950ef8072dc",
"quantity": 2,
"type": "SalesItemLineDetail",
"unit_price": 50
}
]
}'

The following is an example request that creates a Line Item for an existing Invoice:

curl --request POST https://api.agaveapi.com/ar-invoices/{ar_invoice_id}/line-items \
--header 'API-Version: 2021-11-21' \
--header 'Client-Id: your_client_id' \
--header 'Client-Secret: your_client_secret' \
--header 'Account-Token: account_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 100,
"description": "New Line Item",
"item_id": "b840285e-e65f-4342-943f-5950ef8072dc",
"quantity": 2,
"type": "SalesItemLineDetail",
"unit_price": 50
}'

Updating Line Items

To update an existing Line Item, you need to include the Agave UUID or Source ID of the Line Item from the create request. Note, you cannot add new or update Line Items for an existing financial object (e.g. an AR Invoice) without including /line-items in the request path. Here is an example using the update AR Invoice Line Item request:

curl --request PUT https://api.agaveapi.com/ar-invoices/{ar_invoice_id}/line-items/{id} \
--header 'API-Version: 2021-11-21' \
--header 'Client-Id: your_client_id' \
--header 'Client-Secret: your_client_secret' \
--header 'Account-Token: account_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 100,
"description": "Update Existing Line Item",
"item_id": "b840285e-e65f-4342-943f-5950ef8072dc",
"quantity": 2,
"type": "SalesItemLineDetail",
"unit_price": 50
}'