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

# Add an additional charge to an invoice

> Adds an additional charge to an invoice and updates the amounts of the invoice.

Requires the role `invoices:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/invoices/{invoiceId}/additional-charges
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}/additional-charges:
    post:
      tags:
        - Invoices
      summary: Add an additional charge to an invoice
      description: >-
        Adds an additional charge to an invoice and updates the amounts of the
        invoice.


        Requires the role `invoices:write`.
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: invoiceId
          required: true
          description: The unique identifier of the invoice in our system.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                productId:
                  type: string
                  format: uuid
                  description: >-
                    The unique identifier of the product that the additional
                    charge belongs to.
                itemId:
                  type: string
                  format: uuid
                  nullable: true
                  description: >-
                    The unique identifier of the catalog item that the
                    additional charge bills. Null when the additional charge
                    names no item.
                name:
                  type: string
                  description: The name of the additional charge, as the invoice shows it.
                  example: Taxa de entrega extra
                amount:
                  type: integer
                  minimum: 1
                  description: The amount that the additional charge bills, in cents.
                startDate:
                  type: string
                  format: date
                  description: >-
                    The first day of the period that the additional charge
                    bills.
                endDate:
                  type: string
                  format: date
                  description: The last day of the period that the additional charge bills.
              required:
                - productId
                - name
                - amount
                - startDate
                - endDate
              additionalProperties: false
        required: true
        description: >-
          The additional charge to add to the invoice. Leave itemId out, or send
          null, when the additional charge names no catalog item.
      responses:
        '201':
          description: >-
            A line item, not a plan charge, that a user adds by hand to an
            invoice.
          content:
            application/json:
              schema:
                type: object
                properties:
                  lineItemId:
                    type: string
                    format: uuid
                    description: >-
                      The unique identifier of the line item of the additional
                      charge in our system.
                  productId:
                    type: string
                    format: uuid
                    description: >-
                      The unique identifier of the product that the additional
                      charge belongs to.
                  itemId:
                    type: string
                    format: uuid
                    nullable: true
                    description: >-
                      The unique identifier of the catalog item that the
                      additional charge bills. Null when the additional charge
                      names no item.
                  name:
                    type: string
                    description: >-
                      The name of the additional charge, as the invoice shows
                      it.
                    example: Taxa de entrega extra
                  amount:
                    type: integer
                    minimum: 1
                    description: The amount that the additional charge bills, in cents.
                  startDate:
                    type: string
                    format: date
                    description: >-
                      The first day of the period that the additional charge
                      bills.
                  endDate:
                    type: string
                    format: date
                    description: >-
                      The last day of the period that the additional charge
                      bills.
                required:
                  - lineItemId
                  - productId
                  - itemId
                  - name
                  - amount
                  - startDate
                  - endDate
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: a path parameter or the body
            breaks the schema of the endpoint.

            - `invoice_cannot_be_updated`: the invoice is locked, because it was
            issued or canceled.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - json_schema_validation_error
                      - invoice_cannot_be_updated
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                json_schema_validation_error:
                  value:
                    message: '''productId'' is required'
                    code: json_schema_validation_error
                invoice_cannot_be_updated:
                  value:
                    message: >-
                      invoice is not a one-off invoice and cannot be modified
                      through the public API
                    code: invoice_cannot_be_updated
        '401':
          description: >-
            The request carries no API key.


            - `no_authorization`: the request carries no API key in the
            `X-API-KEY` header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - no_authorization
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                no_authorization:
                  value:
                    message: No authorization provided
                    code: no_authorization
        '403':
          description: >-
            The API key cannot call the endpoint.


            - `bad_auth`: the API key does not hold the role that the endpoint
            requires.

            - `invalid_api_key`: the API key does not exist.

            - `deactivated_api_key`: the API key is deactivated.

            - `revoked_api_key`: the API key is revoked.

            - `expired_api_key`: the API key is past its expiry date.

            - `ip_not_allowed`: the tenant does not allow the IP of the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - bad_auth
                      - invalid_api_key
                      - deactivated_api_key
                      - revoked_api_key
                      - expired_api_key
                      - ip_not_allowed
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                bad_auth:
                  value:
                    message: role invoices:write can not be satisfied
                    code: bad_auth
                invalid_api_key:
                  value:
                    message: Invalid API key
                    code: invalid_api_key
                deactivated_api_key:
                  value:
                    message: Deactivated API key
                    code: deactivated_api_key
                revoked_api_key:
                  value:
                    message: Revoked API key
                    code: revoked_api_key
                expired_api_key:
                  value:
                    message: Expired API key
                    code: expired_api_key
                ip_not_allowed:
                  value:
                    message: IP not allowed
                    code: ip_not_allowed
        '404':
          description: |-
            A record that the request names does not exist in the tenant.

            - `product_not_found`: no product of the tenant has the `productId`.
            - `item_not_found`: no item of the tenant has the `itemId`.
            - `invoice_not_found`: no invoice of the tenant has the `invoiceId`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - product_not_found
                      - item_not_found
                      - invoice_not_found
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                product_not_found:
                  value:
                    message: default product not found
                    code: product_not_found
                item_not_found:
                  value:
                    message: item not found
                    code: item_not_found
                invoice_not_found:
                  value:
                    message: invoice not found
                    code: invoice_not_found
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.