> ## 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 Bill

> Create a new Bill.

A **Bills record** of goods or services purchased from a vendor.

## Additional Required Fields

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

| Integration    | Field     | Description                                |
| -------------- | --------- | ------------------------------------------ |
| MYOB\_BUSINESS | tax\_code | The tax code to which the contact belongs. |


## OpenAPI

````yaml POST /accounting/bills
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/bills:
    post:
      tags:
        - AccountingBills
      summary: Create Bills
      description: Add a bill.
      operationId: accounting_bills_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateBillsRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - contact_id: '123456'
                      document_number: ROOTFI01
                      posted_date: '2021-09-28T15:00:00.000Z'
                      due_date: '2021-09-28T15:00:00.000Z'
                      currency_id: GBP
                      memo: Test Invoice
                      line_items:
                        - account_id: '123456'
                          quantity: 1
                          item_id: '123456'
                          tax_id: '123456'
                          unit_amount: 100
                          total_discount: 0
                          description: Test Item
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateBillsResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: aXI9pUDA5T7E2LS
                      data:
                        - job_id: xQm2K441VosP8W4
                          status: success
                          response:
                            platform_id: '3770712000001685001'
                            contact_id: '3770712000000418001'
                            currency_id: '3770712000000000099'
                            document_number: BIL84705
                            posted_date: '2023-03-17T00:00:00.000Z'
                            due_date: '2024-03-19T00:00:00.000Z'
                            memo: Test Invoice
                            currency_rate: 12
                            status: SUBMITTED
                            total_amount: 212.8
                            sub_total: 190
                            total_discount: 0
                            tax_amount: 22.8
                            amount_due: 212.8
                            purchase_order_ids:
                              - '3770712000000000099'
                            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: b2e791f5-7384-4e4f-800f-5c032f6bb61b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateBillsRequest:
      title: accountingtypesCreateBillsRequest
      type: object
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBillsWriteRequestFields'
          description: The data to be passed through to the integration platform
      required:
        - company_id
        - data
    accountingtypesCreateBillsResponse:
      title: accountingtypesCreateBillsResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateBillsResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesBillsWriteRequestFields:
      title: accountingtypesBillsWriteRequestFields
      type: object
      properties:
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItems'
          nullable: true
          description: Array of Bill Line items associated with the bill
        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/accountingtypesBillsAllResponsesCommonFields'
    accountingtypesFinalCreateBillsResponse:
      title: accountingtypesFinalCreateBillsResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateBillsResponseData'
      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
    LineItems:
      title: LineItems
      type: object
      properties:
        account_id:
          type: string
          nullable: true
          description: The ID of the account in the accounting platform
        quantity:
          type: number
          format: double
          nullable: true
          description: The quantity of the item
        item_id:
          type: string
          nullable: true
          description: The ID of the item in the accounting platform
        tax_id:
          type: string
          nullable: true
          description: The ID of the tax in the accounting platform
        unit_amount:
          type: number
          format: double
          nullable: true
          description: The unit amount of the item
        total_discount:
          type: number
          format: double
          nullable: true
          description: The total discount on the item
        description:
          type: string
          nullable: true
          description: The description of the item
        tracking_category_ids:
          type: array
          items:
            type: string
          nullable: true
          description: The IDs of the tracking categories in the accounting platform
    accountingtypesBillsAllResponsesCommonFields:
      title: accountingtypesBillsAllResponsesCommonFields
      type: object
      properties:
        contact_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique ID of the contact associated with
            this bill
        currency_id:
          type: string
          nullable: true
          description: The ISO-4217 currency code of the bill
        document_number:
          type: string
          nullable: true
          description: Reference number for the bill
        posted_date:
          type: string
          nullable: true
          description: Date of creation of the bill
        due_date:
          type: string
          nullable: true
          description: The due date for the bill
        memo:
          type: string
          nullable: true
          description: Memo or description of the bill
    accountingtypesCreateBillsResponseData:
      title: accountingtypesCreateBillsResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBillsResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    accountingtypesBillsResponse:
      title: accountingtypesBillsResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/accountingtypesBillsWriteResponseFields'
        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
    accountingtypesBillsWriteResponseFields:
      title: accountingtypesBillsWriteResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we receive from the accounting platform for
            this bill
      allOf:
        - $ref: '#/components/schemas/accountingtypesBillsResponseField'
    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
    accountingtypesBillsResponseField:
      title: accountingtypesBillsResponseField
      type: object
      properties:
        currency_rate:
          type: number
          format: double
          nullable: true
          description: Rate between the currency of the bill and the base currency
        status:
          $ref: '#/components/schemas/ArtifactStatus'
          nullable: true
          description: The status of the bill.
        total_amount:
          type: number
          format: double
          nullable: true
          description: Total amount of the bill
        sub_total:
          type: number
          format: double
          nullable: true
          description: Total pre-tax amount of the bill
        total_discount:
          type: number
          format: double
          nullable: true
          description: Total discount amount levied on the bill
        tax_amount:
          type: number
          format: double
          nullable: true
          description: Total tax amount levied on the bill
        amount_due:
          type: number
          format: double
          nullable: true
          description: Outstanding amount to be paid for the bill
        purchase_order_ids:
          type: array
          items:
            type: string
          nullable: true
          description: Array of Purchase Order IDs associated with the bill
        updated_at:
          type: string
          nullable: true
          description: The date at which the bill was updated on the accounting platform
      allOf:
        - $ref: '#/components/schemas/accountingtypesBillsPlatformId'
        - $ref: '#/components/schemas/accountingtypesBillsAllResponsesCommonFields'
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    ArtifactStatus:
      title: ArtifactStatus
      type: string
      enum:
        - DRAFT
        - SUBMITTED
        - PARTIALLY_PAID
        - PAID
        - OVERDUE
        - VOID
        - UNKNOWN
    accountingtypesBillsPlatformId:
      title: accountingtypesBillsPlatformId
      type: object
      properties:
        platform_id:
          type: string
          nullable: true
          description: The ID that the accounting platform uses to identify this bill
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````