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

# Create invoice line item group

> Creates a line item group on a one-off invoice. The group is created empty; group amounts are derived from child line items. Empty groups are allowed.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/invoices/{invoiceId}/line-item-groups
openapi: 3.1.0
info:
  title: API Reference
  version: '1.0'
  description: Aira API Reference
  x-logo:
    url: https://static.useaira.com/images/airalogo.svg
    backgroundColor: '#FFFFFF'
    altText: Aira Logo
servers:
  - url: https://api.useaira.com
    description: API base URL
security:
  - ApiKey: []
paths:
  /v1/invoices/{invoiceId}/line-item-groups:
    post:
      tags:
        - Invoices
      summary: Create invoice line item group
      description: >-
        Creates a line item group on a one-off invoice. The group is created
        empty; group amounts are derived from child line items. Empty groups are
        allowed.
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: invoiceId
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                idempotencyKey:
                  type: string
                  minLength: 1
                  pattern: ^[a-zA-Z0-9_-]+$
                  description: >-
                    A unique idempotency key for this group, scoped to the
                    invoice.
                productId:
                  type: string
                  format: uuid
                  description: The product to associate with this group.
                name:
                  type: string
                  nullable: true
                  description: Optional group name; defaults to the product name when null.
                startDate:
                  type: string
                  format: date
                endDate:
                  type: string
                  format: date
              required:
                - idempotencyKey
                - productId
                - startDate
                - endDate
              additionalProperties: false
        required: true
        description: >-
          Schema for creating a line item group container for an existing
          one-off invoice. The group is created empty; line items are added via
          the line-items endpoint. Empty groups are allowed.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  idempotencyKey:
                    type: string
                  customerId:
                    type: string
                    format: uuid
                  productId:
                    type: string
                    format: uuid
                  planId:
                    type: string
                    nullable: true
                    format: uuid
                  planInstanceId:
                    type: string
                    nullable: true
                    format: uuid
                  name:
                    type: string
                  startDate:
                    type: string
                    format: date
                  endDate:
                    type: string
                    format: date
                  subtotalAmount:
                    type: number
                  adjustmentAmount:
                    type: number
                  totalAmount:
                    type: number
                  discountAmount:
                    type: number
                  lineItems:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        idempotencyKey:
                          type: string
                        customerId:
                          type: string
                          format: uuid
                        productId:
                          type: string
                          format: uuid
                        itemId:
                          type: string
                          nullable: true
                          format: uuid
                        resourceId:
                          type: string
                          nullable: true
                          format: uuid
                        lineItemGroupId:
                          type: string
                          nullable: true
                          format: uuid
                        name:
                          type: string
                        scope:
                          type: string
                          enum:
                            - credit_purchase
                            - contract_minimum_amount
                            - plan_minimum_amount
                            - plan_fixed_amount
                            - metric
                            - additional_charge
                            - one_off
                            - tax_gross_up
                        startDate:
                          type: string
                          format: date
                        endDate:
                          type: string
                          format: date
                        totalUsage:
                          type: number
                          nullable: true
                        usageFormat:
                          type: string
                          enum:
                            - unit
                            - currency
                            - null
                          nullable: true
                        subtotalAmount:
                          type: number
                        adjustmentAmount:
                          type: number
                        totalAmount:
                          type: number
                        discountAmount:
                          type: number
                        metadata:
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - metric
                                billingModel:
                                  type: string
                                  enum:
                                    - in_full
                                    - proration
                                priceTierDivision:
                                  type: string
                                  enum:
                                    - unique_tier
                                    - progressive
                              required:
                                - type
                                - billingModel
                                - priceTierDivision
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - contract_minimum_amount
                                minimumAmount:
                                  type: number
                                minimumAmountApplied:
                                  type: number
                              required:
                                - type
                                - minimumAmount
                                - minimumAmountApplied
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - plan_minimum_amount
                                minimumAmount:
                                  type: number
                                minimumAmountApplied:
                                  type: number
                              required:
                                - type
                                - minimumAmount
                                - minimumAmountApplied
                            - type: 'null'
                        subLineItems:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                              type:
                                type: string
                                enum:
                                  - fixed_price
                                  - minimum_amount
                                  - price_tier_flat
                                  - price_tier_unit
                                  - price_tier_package
                                  - price_tier_basis_points
                                  - proration
                                  - unit_price
                              name:
                                type: string
                              description:
                                type: string
                                nullable: true
                              usage:
                                type: number
                                nullable: true
                              amount:
                                type: number
                              metadata:
                                anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - fixed_price
                                      fixedPrice:
                                        type: number
                                    required:
                                      - type
                                      - fixedPrice
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - minimum_amount
                                      minimumAmount:
                                        type: number
                                      minimumAmountApplied:
                                        type: number
                                    required:
                                      - type
                                      - minimumAmount
                                      - minimumAmountApplied
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - price_tier_flat
                                      from:
                                        type: number
                                      to:
                                        type: number
                                        nullable: true
                                      fixedPrice:
                                        type: string
                                    required:
                                      - type
                                      - from
                                      - to
                                      - fixedPrice
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - price_tier_unit
                                      from:
                                        type: number
                                      to:
                                        type: number
                                        nullable: true
                                      price:
                                        type: string
                                      fixedPrice:
                                        type: string
                                        nullable: true
                                    required:
                                      - type
                                      - from
                                      - to
                                      - price
                                      - fixedPrice
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - price_tier_package
                                      from:
                                        type: number
                                      to:
                                        type: number
                                        nullable: true
                                      packageSize:
                                        type: number
                                      price:
                                        type: string
                                      fixedPrice:
                                        type: string
                                        nullable: true
                                    required:
                                      - type
                                      - from
                                      - to
                                      - packageSize
                                      - price
                                      - fixedPrice
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - price_tier_basis_points
                                      from:
                                        type: number
                                      to:
                                        type: number
                                        nullable: true
                                      basisPoints:
                                        type: number
                                      fixedPrice:
                                        type: string
                                        nullable: true
                                    required:
                                      - type
                                      - from
                                      - to
                                      - basisPoints
                                      - fixedPrice
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - proration
                                      intervalSize:
                                        type: number
                                      amount:
                                        type: string
                                      usage:
                                        type: number
                                      intervalStart:
                                        type: string
                                        format: date
                                      intervalEnd:
                                        type: string
                                        format: date
                                    required:
                                      - type
                                      - intervalSize
                                      - amount
                                      - usage
                                      - intervalStart
                                      - intervalEnd
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - unit_price
                                      price:
                                        type: string
                                    required:
                                      - type
                                      - price
                            required:
                              - id
                              - type
                              - name
                              - description
                              - usage
                              - amount
                              - metadata
                            additionalProperties: false
                        adjustments:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                              name:
                                type: string
                              type:
                                type: string
                                enum:
                                  - monetary_discount
                                  - allocation_offset
                              amount:
                                type: number
                            required:
                              - id
                              - name
                              - type
                              - amount
                            additionalProperties: false
                      required:
                        - id
                        - idempotencyKey
                        - customerId
                        - productId
                        - resourceId
                        - lineItemGroupId
                        - name
                        - scope
                        - startDate
                        - endDate
                        - totalUsage
                        - usageFormat
                        - subtotalAmount
                        - adjustmentAmount
                        - totalAmount
                        - discountAmount
                        - metadata
                        - subLineItems
                        - adjustments
                      additionalProperties: false
                required:
                  - id
                  - idempotencyKey
                  - customerId
                  - productId
                  - planId
                  - planInstanceId
                  - name
                  - startDate
                  - endDate
                  - subtotalAmount
                  - adjustmentAmount
                  - totalAmount
                  - discountAmount
                  - lineItems
                additionalProperties: false
        '400':
          description: Error object returned to the client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
                  code:
                    type: string
                    description: A unique identifier for the type of error
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      Additional context about the error, such as invalid fields
                      or constraints. Each endpoint may include specific error
                      details in their documentation
                  causations:
                    type: array
                    description: >-
                      Optional array of error objects following the same
                      structure as the parent error. Only present when there's a
                      meaningful chain of related errors to expose
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: >-
                            A human-readable description of the underlying error
                            cause
                        code:
                          type: string
                          description: A unique identifier for the type of underlying error
                        details:
                          type: object
                          additionalProperties: true
                          description: Additional context about the underlying error
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - code
                  - message
                additionalProperties: false
        '404':
          description: Error object returned to the client when a resource is not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
        '409':
          description: Error object returned to the client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
                  code:
                    type: string
                    description: A unique identifier for the type of error
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      Additional context about the error, such as invalid fields
                      or constraints. Each endpoint may include specific error
                      details in their documentation
                  causations:
                    type: array
                    description: >-
                      Optional array of error objects following the same
                      structure as the parent error. Only present when there's a
                      meaningful chain of related errors to expose
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: >-
                            A human-readable description of the underlying error
                            cause
                        code:
                          type: string
                          description: A unique identifier for the type of underlying error
                        details:
                          type: object
                          additionalProperties: true
                          description: Additional context about the underlying error
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - code
                  - message
                additionalProperties: false
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````