> ## Documentation Index
> Fetch the complete documentation index at: https://integrations.docs.commenda.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Item

> Create an item.

**The Items Data Model** is designed to simplify the management and retrieval of item-related information across various accounting platforms.

## Additional Required Fields

To successfully create an item, certain fields must be included in the raw\_data object of the request body. The required fields are as follows:

| Integration           | Field                   | Description                                               |
| --------------------- | ----------------------- | --------------------------------------------------------- |
| NETSUITE              | taxschedule             | The ID of the tax schedule associated with the item.      |
| MS\_DYNAMICS\_365\_FO | ProductNumber           | The product number of the item.                           |
| MYOB\_BUSINESS        | asset\_account\_id      | The ID of the asset account associated with the item.     |
| QOYOD                 | product\_unit\_type\_id | The ID of the product unit type associated with the item. |
| QOYOD                 | category\_id            | The ID of the category associated with the item.          |
| QOYOD                 | track\_quantity         | Whether the item should track quantity.                   |
| QOYOD                 | tax\_id                 | The ID of the tax associated with the item.               |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.rootfi.dev/v3/accounting/items \
    --header 'Content-Type: application/json' \
    --header 'api_key: <api-key>' \
    --data '{
    "company_id": 1,
    "data": [
      {
        "name": "Rootfi Test Item",
        "description": "Rootfi Test Item",
        "type": "INVENTORY",
        "code": "1234567890",
        "quantity_on_hand": 0,
        "bill_item": {
          "account_id": "123456",
          "unit_price": 100
        },
        "invoice_item": {
          "account_id": "123456",
          "unit_price": 100
        }
      }
    ]
  }'
  ```

  ```javascript NodeJS theme={null}
  import { RootFiClient } from "rootfi-api";
  const rootfi = new RootFiClient({ apiKey: "<api_key>" });

  await rootfi.accounting.items.create({
    company_id: 1,
    data: [
      {
        name: "Rootfi Test Item",
        description: "Rootfi Test Item",
        type: "INVENTORY",
        code: "1234567890",
        quantity_on_hand: 0,
        bill_item: {
          account_id: "123456",
          unit_price: 100,
        },
        invoice_item: {
          account_id: "123456",
          unit_price: 100,
        },
      },
    ],
  });
  ```
</RequestExample>


## OpenAPI

````yaml POST /accounting/items
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/items:
    post:
      tags:
        - AccountingItems
      summary: Create Items
      description: Add an item.
      operationId: accounting_items_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateItemsRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - name: Rootfi Test Item
                      description: Rootfi Test Item
                      type: INVENTORY
                      code: '1234567890'
                      quantity_on_hand: 0
                      bill_item:
                        account_id: '123456'
                        unit_price: 100
                      invoice_item:
                        account_id: '123456'
                        unit_price: 100
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateItemsResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '3770712000001690001'
                            name: Toy Car
                            description: Test Item description
                            type: INVENTORY
                            code: I02
                            quantity_on_hand: 12
                            bill_item:
                              account_id: '3770712000000076060'
                              description: Bill Item Description
                              unit_price: 10
                            invoice_item:
                              account_id: '3770712000000000388'
                              description: Invoice Item Description
                              unit_price: 11
                            is_bill_item: true
                            is_invoice_item: true
                            status: ACTIVE
                            updated_at: '2023-11-01T00:00:00.000Z'
                            raw_data:
                              platform_id: '123456'
                              nominal_code: Rootfi 01
                              name: Test Account
                              description: Test Description
                              category: LIABILITY
                              sub_category: Long Term Liabilities
                              status: ACTIVE
                          error: null
                    request_timestamp: '2021-09-28T15:00:00.000Z'
                    response_timestamp: '2021-09-28T15:00:00.000Z'
                    request_id: 7a1c0e42-9f85-4d6e-bb5d-358a72913c0b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateItemsRequest:
      title: accountingtypesCreateItemsRequest
      type: object
      description: Create items
      properties:
        company_id:
          type: integer
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesItemsWriteRequestFields'
      required:
        - company_id
        - data
    accountingtypesCreateItemsResponse:
      title: accountingtypesCreateItemsResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateitemsResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesItemsWriteRequestFields:
      title: accountingtypesItemsWriteRequestFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: '#/components/schemas/accountingtypesItemsAllResponsesCommonFields'
    accountingtypesFinalCreateitemsResponse:
      title: accountingtypesFinalCreateitemsResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateItemsResponseData'
      required:
        - data
    timestamp:
      title: timestamp
      type: object
      properties:
        request_timestamp:
          type: string
          format: date-time
          description: The time at which the request was received by the server
        response_timestamp:
          type: string
          format: date-time
          description: The time at which the response was sent by the server
        request_id:
          type: string
          description: The unique ID of the request
      required:
        - request_timestamp
        - response_timestamp
        - request_id
    accountingtypesItemsAllResponsesCommonFields:
      title: accountingtypesItemsAllResponsesCommonFields
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: Name of the item
        description:
          type: string
          nullable: true
          description: Description of the item
        type:
          $ref: '#/components/schemas/ItemEnum'
          nullable: true
          description: Type of the item.
        code:
          type: string
          nullable: true
          description: Reference code of the item
        quantity_on_hand:
          type: number
          format: double
          nullable: true
          description: Quantity on hand
        bill_item:
          $ref: '#/components/schemas/BillInvoiceItem'
          nullable: true
          description: Item details of this item getting purchased
        invoice_item:
          $ref: '#/components/schemas/BillInvoiceItem'
          nullable: true
          description: Item details of this item getting sold
    accountingtypesCreateItemsResponseData:
      title: accountingtypesCreateItemsResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesItemsResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    ItemEnum:
      title: ItemEnum
      type: string
      enum:
        - INVENTORY
        - NON_INVENTORY
        - SERVICE
        - UNKNOWN
    BillInvoiceItem:
      title: BillInvoiceItem
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: The raw data of the item
        account_id:
          type: string
          description: The ID of the account in the accounting platform
        unit_price:
          type: number
          format: double
          description: The unit price of the item
        description:
          type: string
          nullable: true
          description: The description of the item
        tax_id:
          type: string
          nullable: true
          description: The ID of the tax in the accounting platform
      required:
        - account_id
        - unit_price
    accountingtypesItemsResponse:
      title: accountingtypesItemsResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/accountingtypesItemsWriteResponseFields'
        error:
          $ref: '#/components/schemas/ErrorObject'
          nullable: true
          description: The error message if the job failed.
      required:
        - response
      allOf:
        - $ref: '#/components/schemas/JobSuccessResponse'
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
          description: The status of the job.
        upload_job_id:
          type: string
          description: The ID of the job.
      required:
        - status
        - upload_job_id
    accountingtypesItemsWriteResponseFields:
      title: accountingtypesItemsWriteResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we get from the accounting platform for that
            data
      allOf:
        - $ref: '#/components/schemas/accountingtypesItemsResponseFields'
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        platform_error:
          type: string
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
        - platform_error
    JobSuccessResponse:
      title: JobSuccessResponse
      type: object
      properties:
        job_id:
          type: string
          description: The ID of the job.
        status:
          $ref: '#/components/schemas/JobResponseStatus'
          description: The status of the job.
      required:
        - job_id
        - status
    Status:
      title: Status
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CREATED
        - RUNNING
    accountingtypesItemsResponseFields:
      title: accountingtypesItemsResponseFields
      type: object
      properties:
        is_bill_item:
          type: boolean
          description: >-
            Check if there are details (bill_item) of this item getting
            purchased
        is_invoice_item:
          type: boolean
          description: Check if there are details (invoice_item) of this item getting sold
        status:
          $ref: '#/components/schemas/BaseStaus'
          nullable: true
          description: Status of the item.
        updated_at:
          type: string
          description: >-
            The date on which the information was updated on the accounting
            platform
      required:
        - is_bill_item
        - is_invoice_item
        - updated_at
      allOf:
        - $ref: '#/components/schemas/accountingtypesItemsPlatformId'
        - $ref: '#/components/schemas/accountingtypesItemsAllResponsesCommonFields'
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    BaseStaus:
      title: BaseStaus
      type: string
      enum:
        - ACTIVE
        - ARCHIVED
        - UNKNOWN
    accountingtypesItemsPlatformId:
      title: accountingtypesItemsPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this item
      required:
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````