> 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

# Create item

POST https://api-sandbox.payabli.com/api/LineItem/{entry}
Content-Type: application/json

Adds products and services to an entrypoint's catalog. These are used as line items for invoicing and transactions. In the response, "responseData" displays the item's code.

Reference: https://docs.payabli.com/developers/api-reference/lineitem/add-item-to-entrypoint-catalog

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /LineItem/{entry}:
    post:
      operationId: AddItem
      summary: Add item to entrypoint catalog
      description: >-
        Adds products and services to an entrypoint's catalog. These are used as
        line items for invoicing and transactions. In the response,
        "responseData" displays the item's code.
      tags:
        - lineItem
      parameters:
        - name: entry
          in: path
          description: >-
            The paypoint's entrypoint identifier. [Learn
            more](/developers/api-reference/api-overview#entrypoint-vs-entry)
          required: true
          schema:
            type: string
        - name: requestToken
          in: header
          description: >
            Long-lived API token sent in the `requestToken` header. See [API
            token authentication](/developers/api-tokens).
          required: true
          schema:
            type: string
        - name: idempotencyKey
          in: header
          description: >-
            A unique ID you can include to prevent duplicating objects or
            transactions if a request is sent more than once. This key isn't
            generated in Payabli, you must generate it yourself.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliApiResponse6'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LineItem'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    ItemCommodityCode:
      type: string
      description: Item or product commodity code. Max length of 250 characters.
      title: ItemCommodityCode
    ItemDescription:
      type: string
      description: Item or product description. Max length of 250 characters.
      title: ItemDescription
    ItemProductCode:
      type: string
      description: Item or product code. Max length of 250 characters.
      title: ItemProductCode
    ItemProductName:
      type: string
      description: Item or product name. Max length of 250 characters.
      title: ItemProductName
    ItemUnitofMeasure:
      type: string
      description: Unit of measurement. Max length of 100 characters.
      title: ItemUnitofMeasure
    LineItem:
      type: object
      properties:
        itemCategories:
          type: array
          items:
            type: string
          description: Array of tags classifying item or product.
        itemCommodityCode:
          $ref: '#/components/schemas/ItemCommodityCode'
        itemCost:
          type: number
          format: double
          description: Item or product price per unit.
        itemDescription:
          $ref: '#/components/schemas/ItemDescription'
        itemMode:
          type: integer
          description: >-
            Internal class of item or product: value '0' is only for invoices,
            '1' for bills, and '2' is common for both.
        itemProductCode:
          $ref: '#/components/schemas/ItemProductCode'
        itemProductName:
          $ref: '#/components/schemas/ItemProductName'
        itemQty:
          type: integer
          description: Quantity of item or product.
        itemUnitOfMeasure:
          $ref: '#/components/schemas/ItemUnitofMeasure'
      required:
        - itemCost
        - itemQty
      title: LineItem
    IsSuccess:
      type: boolean
      description: |
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    PageIdentifier:
      type: string
      description: Auxiliary validation used internally by payment pages and components.
      title: PageIdentifier
    Responsedatanonobject:
      oneOf:
        - type: string
        - type: integer
      description: The response data.
      title: Responsedatanonobject
    ResponseText:
      type: string
      description: |
        Response text for operation: 'Success' or 'Declined'.
      title: ResponseText
    PayabliApiResponse6:
      type: object
      properties:
        isSuccess:
          $ref: '#/components/schemas/IsSuccess'
        pageIdentifier:
          $ref: '#/components/schemas/PageIdentifier'
        responseData:
          $ref: '#/components/schemas/Responsedatanonobject'
          description: >-
            If `isSuccess` = true, this contains the line item identifier. If
            `isSuccess` = false, this contains the reason for the error.
        responseText:
          $ref: '#/components/schemas/ResponseText'
      required:
        - responseText
      description: Response schema for line item operations.
      title: PayabliApiResponse6
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken
      description: >
        Long-lived API token sent in the `requestToken` header. See [API token
        authentication](/developers/api-tokens).
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        OAuth2 Bearer access token from the client-credentials flow. See [OAuth
        authentication](/developers/oauth-authentication).

```

## Examples



**Request**

```json
{
  "itemCost": 12.45,
  "itemQty": 1,
  "itemCommodityCode": "010",
  "itemDescription": "Deposit for materials",
  "itemMode": 0,
  "itemProductCode": "M-DEPOSIT",
  "itemProductName": "Materials deposit",
  "itemUnitOfMeasure": "SqFt"
}
```

**Response**

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

**SDK Code**

```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()
```