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

# Generate InvoiceLineItems for an Invoice for a Company

> Generate `InvoiceLineItems` for an `Invoice` for a `Company`

This endpoint only generates the `InvoiceLineItems` based on the inputs and does not store any data on the backend



## OpenAPI

````yaml /api-reference/openapi.json post /v1/companies/{company-id}/invoices/{invoice-id}/invoice_line_items/generate
openapi: 3.0.3
info:
  title: Horizon API V1
  version: '1.0'
  contact:
    name: Tread
    url: https://tread.io
    email: developers@tread.io
  description: >-
    This is the Version 1 implementation.


    When in doubt we default to the practices outlined
    [here](https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries)
  license:
    name: Private
    url: https://tread.io
servers:
  - description: production
    url: https://api.tread-horizon.com
security:
  - bearerAuth: []
tags:
  - name: Projects
  - name: Orders
  - name: Loads
  - name: Jobs
  - name: JobAssignments
  - name: ApprovalAssignments
  - name: Equipment
  - name: FuelSurcharges
  - name: Materials
  - name: Accounts
  - name: Tickets
  - name: Users
  - name: Sites
  - name: Companies
  - name: Departments
  - name: Rates
  - name: Services
  - name: EquipmentType
  - name: FileAttachments
  - name: MaterialType
  - name: LineItemType
  - name: DriverStateEvent
  - name: Authentication
  - name: IamRoles
  - name: Typeaheads
  - name: Integrations
  - name: Reflection
  - name: LoadCycles
  - name: AddOns
  - name: ServiceClass
  - name: Invoices
  - name: JobSummaries
  - name: LoadSummaries
  - name: CompanyShares
  - name: UserDevicePermission
  - name: Drivers
  - name: Settlements
  - name: LocationHistories
  - name: Telematics
  - name: OmniReports
  - name: DriverDays
  - name: Agave
  - name: AddOnCharges
  - name: ResourceUsageLogs
  - name: ResourceScopes
  - name: TravelledDistances
  - name: MaterialRates
  - name: CompanyDayJobStats
  - name: KMLFiles
  - name: AutoAddOnAssignments
  - name: SiteRateSchedules
  - name: TwilioIntegrations
  - name: Foremen
  - name: AccountExternalTruckIdentifier
  - name: GeofenceTriggers
  - name: Labels
  - name: Compliance
  - name: ComplianceDocuments
paths:
  /v1/companies/{company-id}/invoices/{invoice-id}/invoice_line_items/generate:
    parameters:
      - schema:
          type: string
          format: uuid
        name: company-id
        in: path
        required: true
        description: Company ID
      - schema:
          type: string
        name: invoice-id
        in: path
        required: true
        description: Invoice ID
      - $ref: '#/components/parameters/Accept-Language'
    post:
      tags:
        - Invoices
      summary: Generate InvoiceLineItems for an Invoice for a Company
      description: >-
        Generate `InvoiceLineItems` for an `Invoice` for a `Company`


        This endpoint only generates the `InvoiceLineItems` based on the inputs
        and does not store any data on the backend
      operationId: >-
        post-v1-companies-company-id-invoices-invoice-id-invoice_line_items-generate
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - rate_value
                - rate_type
              properties:
                rate_value:
                  type: number
                  x-stoplight:
                    id: w5z08oggi7syq-company
                rate_type:
                  $ref: '#/components/schemas/RateType'
      responses:
        '200':
          description: OK
          headers: {}
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    x-stoplight:
                      id: pgnb7ip6q7u9m-company
                    items:
                      $ref: '#/components/schemas/InvoiceLineItem-Read-Generated'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/ModelError'
components:
  parameters:
    Accept-Language:
      name: Accept-Language
      in: header
      schema:
        type: string
        default: en
        example: en
      description: >-
        The Accept-Language request HTTP header indicates the natural language
        and locale that the client prefers. 
  schemas:
    RateType:
      title: RateType
      x-stoplight:
        id: zn2jb7gsifkk3
      enum:
        - RatePerHour
        - RatePerDay
        - RatePerLoad
        - RatePerTon
        - RatePerTonne
        - RatePerYard
        - RatePerBushel
        - RateCommission
        - RateFlatCommission
        - RateFlatRate
      example: RatePerHour
    InvoiceLineItem-Read-Generated:
      title: InvoiceLineItem-Read-Generated
      x-stoplight:
        id: oi6xodq6h2g0x
      type: object
      x-internal: true
      required:
        - quantity
        - delivered_quantity
        - rate
        - rate_type
        - total_amount
        - pay_start_time
        - pay_end_time
        - invoice_id
        - name
        - line_item_type
      properties:
        quantity:
          type: string
          x-stoplight:
            id: v1ewx0tm9mbq1
        delivered_quantity:
          type: string
          x-stoplight:
            id: 2l55holcsio85
        rate:
          type: string
          x-stoplight:
            id: 7x4itpvkhp1mj
        rate_type:
          $ref: '#/components/schemas/RateType'
        total_amount:
          type: string
          x-stoplight:
            id: dhenpl6eyi2h6
        pay_start_time:
          type: string
          x-stoplight:
            id: 3u2nmiaxy8nov
          format: date-time
          nullable: true
        pay_end_time:
          type: string
          x-stoplight:
            id: tf570leo8xrqi
          format: date-time
          nullable: true
        invoice_id:
          type: string
          x-stoplight:
            id: kfggtxandaa90
          format: uuid
        name:
          type: string
          x-stoplight:
            id: rf66wutpde5q9
          nullable: true
        load_id:
          type: string
          x-stoplight:
            id: 9ity0xphx2q9o
          format: uuid
          nullable: true
        line_item_type:
          $ref: '#/components/schemas/InvoiceLineItemType'
      additionalProperties: false
    InvoiceLineItemType:
      title: InvoiceLineItemType
      x-stoplight:
        id: clkyxnscmds4j
      enum:
        - InvoiceLineItem
        - MaterialRateLineItem
        - FreightRateLineItem
      default: InvoiceLineItem
    Error-Response:
      title: Error-Response
      x-stoplight:
        id: 52cydhphee3qe
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
      additionalProperties: false
    UnauthenticatedError-Response:
      title: UnauthenticatedError-Response
      x-stoplight:
        id: o477eph7ttbzt
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/UnauthenticatedError'
      additionalProperties: false
    ModelError-Response:
      title: ModelError-Response
      x-stoplight:
        id: payf9ndh3l6np
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ModelError'
      additionalProperties: false
    Error:
      title: Error
      x-stoplight:
        id: 3g57kkik3l464
      type: object
      description: An Error.
      required:
        - code
      properties:
        code:
          type: string
          x-stoplight:
            id: 7o9x1t8v0bgfo
      additionalProperties: false
    UnauthenticatedError:
      title: UnauthenticatedError
      x-stoplight:
        id: 202o69l0fs40h
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          x-stoplight:
            id: tg10dt7s0l6bw
          properties:
            error_type:
              type: string
              x-stoplight:
                id: wvq8c0qsym4hz
          required:
            - error_type
    ModelError:
      title: ModelError
      x-stoplight:
        id: nhp6714o4j1qt
      description: A Model-specific error
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - errors
          properties:
            errors:
              type: array
              x-stoplight:
                id: m4ul9vcq2deh6
              items:
                $ref: '#/components/schemas/ModelError-Item'
    ModelError-Item:
      title: ModelError-Item
      x-stoplight:
        id: b93chwval2t8d
      type: object
      required:
        - model
        - field
        - message
      properties:
        model:
          type: string
          x-stoplight:
            id: 30myfyjkno8ao
          description: The Model associated with this Error
        field:
          type: string
          x-stoplight:
            id: 8gl4ed3uxhdws
          description: The field associated with this Error
        message:
          type: string
          x-stoplight:
            id: bmgbrtmw17qsj
          description: The Error message
      additionalProperties: false
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error-Response'
            type: object
    UnauthenticatedError:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthenticatedError-Response'
            type: object
    ModelError:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ModelError-Response'
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````