> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Manage line items with the API

> Learn how to add and manage line items for products and services via the API

Use Payabli's line item functions to create and manage products or services for invoices and bills. This guide covers the key operations for managing line items through the API.

## Considerations

Keep these considerations in mind when working with line items:

* Line items can be designated for invoices, bills, or both.
* Items are always associated with an organization or a paypoint.
* The `itemMode` parameter determines where items can be used (0=invoices, 1=bills, 2=both).

## Create a line item

Send a POST request to `/api/LineItem/{entryId}` to create a new line item in an entrypoint's catalog. See the [API reference](/developers/api-reference/lineitem/add-item-to-entrypoint-catalog) for full documentation.

This example creates a consultation service line item in the paypoint with ID `47cae3d74`. The item is set for use with invoices only (`itemMode: 0`).

### Request

POST [https://api-sandbox.payabli.com/api/LineItem/\{entry}](https://api-sandbox.payabli.com/api/LineItem/\{entry})

```curl
curl -X POST https://api-sandbox.payabli.com/api/LineItem/8cfec329267 \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "itemCost": 12.45,
  "itemQty": 1,
  "itemCommodityCode": "010",
  "itemDescription": "Deposit for materials",
  "itemMode": 0,
  "itemProductCode": "M-DEPOSIT",
  "itemProductName": "Materials deposit",
  "itemUnitOfMeasure": "SqFt"
}'
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.lineItem.addItem("8cfec329267", {
        body: {
            itemCost: 12.45,
            itemQty: 1,
            itemCommodityCode: "010",
            itemDescription: "Deposit for materials",
            itemMode: 0,
            itemProductCode: "M-DEPOSIT",
            itemProductName: "Materials deposit",
            itemUnitOfMeasure: "SqFt",
        },
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.line_item.add_item(
    entry="8cfec329267",
    item_cost=12.45,
    item_qty=1,
    item_commodity_code="010",
    item_description="Deposit for materials",
    item_mode=0,
    item_product_code="M-DEPOSIT",
    item_product_name="Materials deposit",
    item_unit_of_measure="SqFt",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.resources.lineitem.requests.AddItemRequest;
import io.github.payabli.api.types.LineItem;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.lineItem().addItem(
            "8cfec329267",
            AddItemRequest
                .builder()
                .body(
                    LineItem
                        .builder()
                        .itemCost(12.45)
                        .itemQty(1)
                        .itemCommodityCode("010")
                        .itemDescription("Deposit for materials")
                        .itemMode(0)
                        .itemProductCode("M-DEPOSIT")
                        .itemProductName("Materials deposit")
                        .itemUnitOfMeasure("SqFt")
                        .build()
                )
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.line_item.add_item(
  entry: "8cfec329267",
  item_commodity_code: "010",
  item_cost: 12.45,
  item_description: "Deposit for materials",
  item_mode: 0,
  item_product_code: "M-DEPOSIT",
  item_product_name: "Materials deposit",
  item_qty: 1,
  item_unit_of_measure: "SqFt"
)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.LineItem.AddItemAsync(
            "8cfec329267",
            new AddItemRequest {
                Body = new LineItem {
                    ItemCost = 12.45,
                    ItemQty = 1,
                    ItemCommodityCode = "010",
                    ItemDescription = "Deposit for materials",
                    ItemMode = 0,
                    ItemProductCode = "M-DEPOSIT",
                    ItemProductName = "Materials deposit",
                    ItemUnitOfMeasure = "SqFt"
                }
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.AddItemRequest{
        Body: &payabli.LineItem{
            ItemCost: 12.45,
            ItemQty: 1,
            ItemCommodityCode: payabli.String(
                "010",
            ),
            ItemDescription: payabli.String(
                "Deposit for materials",
            ),
            ItemMode: payabli.Int(
                0,
            ),
            ItemProductCode: payabli.String(
                "M-DEPOSIT",
            ),
            ItemProductName: payabli.String(
                "Materials deposit",
            ),
            ItemUnitOfMeasure: payabli.String(
                "SqFt",
            ),
        },
    }
    client.LineItem.AddItem(
        context.TODO(),
        "8cfec329267",
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\LineItem\Requests\AddItemRequest;
use Payabli\Types\LineItem;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->lineItem->addItem(
    '8cfec329267',
    new AddItemRequest([
        'body' => new LineItem([
            'itemCost' => 12.45,
            'itemQty' => 1,
            'itemCommodityCode' => '010',
            'itemDescription' => 'Deposit for materials',
            'itemMode' => 0,
            'itemProductCode' => 'M-DEPOSIT',
            'itemProductName' => 'Materials deposit',
            'itemUnitOfMeasure' => 'SqFt',
        ]),
    ]),
);

```

```swift
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "itemCost": 12.45,
  "itemQty": 1,
  "itemCommodityCode": "010",
  "itemDescription": "Deposit for materials",
  "itemMode": 0,
  "itemProductCode": "M-DEPOSIT",
  "itemProductName": "Materials deposit",
  "itemUnitOfMeasure": "SqFt"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/LineItem/8cfec329267")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

## Get line item details

Send a GET request to `/api/LineItem/{lineItemId}` to retrieve information about a specific line item. See the [API reference](/developers/api-reference/lineitem/get-item-in-entrypoint) for full documentation.

This example retrieves details for the line item with ID `700`.

### Request

GET [https://api-sandbox.payabli.com/api/LineItem/\{lineItemId}](https://api-sandbox.payabli.com/api/LineItem/\{lineItemId})

```curl
curl https://api-sandbox.payabli.com/api/LineItem/700 \
     -H "requestToken: <apiKey>"
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.lineItem.getItem(700);
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.line_item.get_item(
    line_item_id=700,
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.lineItem().getItem(700);
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.line_item.get_item(line_item_id: 700)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.LineItem.GetItemAsync(
            700
        );
    }

}

```

```go
package example

import (
    context "context"

    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    client.LineItem.GetItem(
        context.TODO(),
        700,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->lineItem->getItem(
    700,
);

```

```swift
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/LineItem/700")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A successful request sends a 200 response with a JSON body that contains the line item details.

### Response (200)

```json
{
  "itemCost": 5,
  "itemQty": 1,
  "createdAt": "2022-07-01T15:00:01Z",
  "id": 700,
  "itemCategories": [
    "itemCategories"
  ],
  "itemCommodityCode": "010",
  "itemDescription": "Deposit for materials.",
  "itemMode": 0,
  "itemProductCode": "M-DEPOSIT",
  "itemProductName": "Materials deposit",
  "itemUnitOfMeasure": "SqFt",
  "lastUpdated": "2022-07-01T15:00:01Z",
  "pageidentifier": "null",
  "ParentOrgName": "PropertyManager Pro",
  "PaypointDbaname": "Sunshine Gutters",
  "PaypointEntryname": "d193cf9a46",
  "PaypointLegalname": "Sunshine Services, LLC"
}
```

## Get list of line items

Send a GET request to `/api/Query/lineitems/{entry}` to retrieve all line items for an entrypoint. See the [API reference](/developers/api-reference/lineitem/get-list-of-items-for-entrypoint) for full documentation.

This example retrieves all line items for the paypoint with ID `47cae3d74`.

### Request

GET [https://api-sandbox.payabli.com/api/Query/lineitems/\{entry}](https://api-sandbox.payabli.com/api/Query/lineitems/\{entry})

```curl
curl -G https://api-sandbox.payabli.com/api/Query/lineitems/8cfec329267 \
     -H "requestToken: <apiKey>" \
     -d fromRecord=251 \
     -d limitRecord=0 \
     -d sortBy=desc(field_name)
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.lineItem.listLineItems("8cfec329267", {
        fromRecord: 251,
        limitRecord: 0,
        sortBy: "desc(field_name)",
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.line_item.list_line_items(
    entry="8cfec329267",
    from_record=251,
    limit_record=0,
    sort_by="desc(field_name)",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.resources.lineitem.requests.ListLineItemsRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.lineItem().listLineItems(
            "8cfec329267",
            ListLineItemsRequest
                .builder()
                .fromRecord(251)
                .limitRecord(0)
                .sortBy("desc(field_name)")
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.line_item.list_line_items(
  entry: "8cfec329267",
  from_record: 251,
  limit_record: 0,
  sort_by: "desc(field_name)"
)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.LineItem.ListLineItemsAsync(
            "8cfec329267",
            new ListLineItemsRequest {
                FromRecord = 251,
                LimitRecord = 0,
                SortBy = "desc(field_name)"
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.ListLineItemsRequest{
        FromRecord: payabli.Int(
            251,
        ),
        LimitRecord: payabli.Int(
            0,
        ),
        SortBy: payabli.String(
            "desc(field_name)",
        ),
    }
    client.LineItem.ListLineItems(
        context.TODO(),
        "8cfec329267",
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\LineItem\Requests\ListLineItemsRequest;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->lineItem->listLineItems(
    '8cfec329267',
    new ListLineItemsRequest([
        'fromRecord' => 251,
        'limitRecord' => 0,
        'sortBy' => 'desc(field_name)',
    ]),
);

```

```swift
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Query/lineitems/8cfec329267?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A successful request sends a 200 response with a JSON body that contains the list of line items.

### Response (200)

```json
{
  "Records": [
    {
      "LineItem": {
        "itemCost": 12.45,
        "itemQty": 1,
        "itemProductName": "Materials deposit"
      },
      "ParentOrgName": "PropertyManager Pro",
      "PaypointDbaname": "Sunshine Gutters",
      "PaypointEntryname": "d193cf9a46",
      "PaypointLegalname": "Sunshine Services, LLC"
    }
  ],
  "Summary": {
    "pageIdentifier": "null",
    "pageSize": 20,
    "totalAmount": 77.22,
    "totalNetAmount": 77.22,
    "totalPages": 2,
    "totalRecords": 2
  }
}
```

## Update a line item

Send a PUT request to `/api/LineItem/{lineItemId}` to modify an existing line item's details. See the [API reference](/developers/api-reference/lineitem/update-item-in-entrypoint) for full documentation.

This example updates the line item with ID `700` to be a materials deposit item with new pricing and measurement details.

### Request

PUT [https://api-sandbox.payabli.com/api/LineItem/\{lineItemId}](https://api-sandbox.payabli.com/api/LineItem/\{lineItemId})

```curl
curl -X PUT https://api-sandbox.payabli.com/api/LineItem/700 \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "itemCost": 12.45,
  "itemQty": 1
}'
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.lineItem.updateItem(700, {
        itemCost: 12.45,
        itemQty: 1,
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.line_item.update_item(
    line_item_id=700,
    item_cost=12.45,
    item_qty=1,
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.types.LineItem;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.lineItem().updateItem(
            700,
            LineItem
                .builder()
                .itemCost(12.45)
                .itemQty(1)
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.line_item.update_item(
  line_item_id: 700,
  item_cost: 12.45,
  item_qty: 1
)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.LineItem.UpdateItemAsync(
            700,
            new LineItem {
                ItemCost = 12.45,
                ItemQty = 1
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.LineItem{
        ItemCost: 12.45,
        ItemQty: 1,
    }
    client.LineItem.UpdateItem(
        context.TODO(),
        700,
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Types\LineItem;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->lineItem->updateItem(
    700,
    new LineItem([
        'itemCost' => 12.45,
        'itemQty' => 1,
    ]),
);

```

```swift
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "itemCost": 12.45,
  "itemQty": 1
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/LineItem/700")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A successful request sends a 200 response with a JSON body that contains the updated line item details. The response is the same as the create line item response.

### Response (200)

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "responseData": 700
}
```

## Delete a line item

Send a DELETE request to `/api/LineItem/{lineItemId}` to remove an existing line item. See the [API reference](/developers/api-reference/lineitem/delete-item-in-entrypoint) for full documentation.

This example deletes the line item with ID `700`.

### Request

DELETE [https://api-sandbox.payabli.com/api/LineItem/\{lineItemId}](https://api-sandbox.payabli.com/api/LineItem/\{lineItemId})

```curl
curl -X DELETE https://api-sandbox.payabli.com/api/LineItem/700 \
     -H "requestToken: <apiKey>"
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.lineItem.deleteItem(700);
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.line_item.delete_item(
    line_item_id=700,
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.lineItem().deleteItem(700);
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.line_item.delete_item(line_item_id: 700)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.LineItem.DeleteItemAsync(
            700
        );
    }

}

```

```go
package example

import (
    context "context"

    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    client.LineItem.DeleteItem(
        context.TODO(),
        700,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->lineItem->deleteItem(
    700,
);

```

```swift
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/LineItem/700")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A successful request sends a 200 response with a JSON body that contains the deleted line item's ID.

### Response (200)

```json
{
  "isSuccess": true,
  "responseText": "Success"
}
```

## Related resources

See these related resources to help you get the most out of Payabli.

* **[Manage invoices with the API](/guides/pay-in-developer-invoices-manage)** - Learn how to create, update, delete, and send invoices with the Payabli API
* **[Manage bills with the API](/guides/pay-out-developer-bills-manage)** - Learn how to add and manage bills for vendors via the API