> ## 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 Credit Note

> Create a new Bill credit note.

An **Bill Credit Note** is a financial transaction representing a reduction that can be applied against one or multiple bills issued to Vendors.

## Additional Required Fields

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

| Integration             | Field          | Description                                                                                             |
| ----------------------- | -------------- | ------------------------------------------------------------------------------------------------------- |
| FRESH\_BOOKS            | currency\_rate | The exchange rate between the currency of the invoice credit note and the base currency of the company. |
| MYOB\_BUSINESS          | tax\_code      | The tax code to which the contact belongs.                                                              |
| SAGE\_CLOUD\_ACCOUNTING | currency\_rate | The exchange rate to be used for the bill credit note.                                                  |


## OpenAPI

````yaml POST /accounting/bill_credit_notes
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/bill_credit_notes:
    post:
      tags:
        - AccountingBillCreditNote
      summary: Create Bill Credit Note
      description: Add a bill credit note.
      operationId: accounting_billCreditNote_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateBillCreditNotesRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - contact_id: '123456'
                      document_number: ROOTFI01
                      posted_date: '2021-09-28T15:00:00.000Z'
                      currency_id: GBP
                      bill_ids: []
                      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/accountingtypesCreateBillCreditNotesResponse
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: aXI9pUDA5T7E2LS
                      data:
                        - job_id: xQm2K441VosP8W4
                          status: success
                          response:
                            platform_id: '3770712000001684001'
                            bill_ids:
                              - '3770712000000213001'
                            contact_id: '3770712000000209007'
                            currency_id: '3770712000000000099'
                            document_number: Bd5200
                            posted_date: '2023-04-17T00:00:00.000Z'
                            memo: psssss
                            remaining_credit: 140
                            total_amount: 140
                            status: SUBMITTED
                            updated_at: '2023-10-31T00: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:
    accountingtypesCreateBillCreditNotesRequest:
      title: accountingtypesCreateBillCreditNotesRequest
      type: object
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/accountingtypesBillCreditNotesWriteRequestFields
      required:
        - company_id
        - data
    accountingtypesCreateBillCreditNotesResponse:
      title: accountingtypesCreateBillCreditNotesResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateBillCreditNotes'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesBillCreditNotesWriteRequestFields:
      title: accountingtypesBillCreditNotesWriteRequestFields
      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/accountingtypesBillCreditNotesAllResponseCommonFields
    accountingtypesFinalCreateBillCreditNotes:
      title: accountingtypesFinalCreateBillCreditNotes
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/accountingtypesCreateBillCreditNotesResponseData
      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
    accountingtypesBillCreditNotesAllResponseCommonFields:
      title: accountingtypesBillCreditNotesAllResponseCommonFields
      type: object
      properties:
        bill_ids:
          type: array
          items:
            type: string
          nullable: true
          description: An Array of bills associated with the credit note
        contact_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the contact
            associated with this credit note
        currency_id:
          type: string
          nullable: true
          description: Currency of the credit note
        document_number:
          type: string
          nullable: true
          description: Reference number for the credit note
        posted_date:
          type: string
          nullable: true
          description: Date on which the credit note was posted
        memo:
          type: string
          nullable: true
          description: Description of the credit note
    accountingtypesCreateBillCreditNotesResponseData:
      title: accountingtypesCreateBillCreditNotesResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBillCreditNotesResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    accountingtypesBillCreditNotesResponse:
      title: accountingtypesBillCreditNotesResponse
      type: object
      properties:
        response:
          $ref: >-
            #/components/schemas/accountingtypesBillCreditNotesWriteResponseFields
        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
    accountingtypesBillCreditNotesWriteResponseFields:
      title: accountingtypesBillCreditNotesWriteResponseFields
      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/accountingtypesBillCreditNotesPlatformId'
        - $ref: '#/components/schemas/accountingtypesBillsCreditNotesResponse'
    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
    accountingtypesBillCreditNotesPlatformId:
      title: accountingtypesBillCreditNotesPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this account
      required:
        - platform_id
    accountingtypesBillsCreditNotesResponse:
      title: accountingtypesBillsCreditNotesResponse
      type: object
      properties:
        remaining_credit:
          type: integer
          nullable: true
          description: The balance amount remaining on the credit note
        total_amount:
          type: integer
          nullable: true
          description: Total amount of credit note
        status:
          $ref: '#/components/schemas/ArtifactStatus'
          nullable: true
          description: The status of the credit note.
        tax_amount:
          type: integer
          nullable: true
          description: The total tax amount of the credit note
        updated_at:
          type: string
          nullable: true
          description: The last ISO 8601 timestamp that the data was updated at
      allOf:
        - $ref: '#/components/schemas/accountingtypesBillCreditNotesPlatformId'
        - $ref: >-
            #/components/schemas/accountingtypesBillCreditNotesAllResponseCommonFields
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    ArtifactStatus:
      title: ArtifactStatus
      type: string
      enum:
        - DRAFT
        - SUBMITTED
        - PARTIALLY_PAID
        - PAID
        - OVERDUE
        - VOID
        - UNKNOWN
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````