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

# Duplicate invoice

> Create a new invoice based on an existing invoice.



## OpenAPI

````yaml post /invoices/{invoiceId}/duplicate
openapi: 3.0.1
info:
  title: Plude
  description: Headless subscription management and recurring billing.
  termsOfService: https://plude.com/terms
  contact:
    name: Corporate Contact
    url: https://plude.com/contact
  license:
    name: License
    url: https://plude.com/license
  version: v4.2024.7.1
servers: []
security:
  - Bearer: []
paths:
  /invoices/{invoiceId}/duplicate:
    post:
      tags:
        - Invoices
      summary: Duplicate invoice
      description: Create a new invoice based on an existing invoice.
      parameters:
        - name: invoiceId
          in: path
          description: Id of invoice to duplicate.
          required: true
          schema:
            type: string
            format: uuid
        - name: x-environment
          in: header
          description: >-
            Configure which environment the request will handle. If the provided
            credentials do not allow access to this specified environment, a 403
            Forbidden response is returned.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Reques options.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateInvoiceRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceDetail'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
components:
  schemas:
    DuplicateInvoiceRequest:
      type: object
      properties:
        reverse:
          type: boolean
          nullable: true
      additionalProperties: false
    InvoiceDetail:
      required:
        - createdAt
        - currency
        - customer
      type: object
      properties:
        memo:
          type: string
          nullable: true
          readOnly: true
        handle:
          type: string
          description: Unique invoice number.
          nullable: true
          readOnly: true
        status:
          $ref: '#/components/schemas/InvoiceStatusEnum'
        id:
          type: string
          format: uuid
          readOnly: true
        date:
          type: string
          format: date
          readOnly: true
        dueDate:
          type: string
          format: date
          nullable: true
          readOnly: true
        currency:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
          nullable: true
        customer:
          $ref: '#/components/schemas/InvoiceCustomer'
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceLine'
          nullable: true
          readOnly: true
        settlements:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceSettlement'
          nullable: true
          readOnly: true
        totalExclVat:
          type: integer
          format: int64
          readOnly: true
        totalVat:
          type: integer
          format: int64
          readOnly: true
        totalInclVat:
          type: integer
          format: int64
          readOnly: true
        totalDue:
          type: integer
          format: int64
          readOnly: true
        type:
          $ref: '#/components/schemas/InvoiceTypeEnum'
        settlementStatus:
          $ref: '#/components/schemas/InvoiceSettlementStatus'
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    InvoiceStatusEnum:
      enum:
        - draft
        - booked
      type: string
    InvoiceCustomer:
      required:
        - handle
        - id
        - name
      type: object
      properties:
        id:
          type: string
          format: uuid
        handle:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        billingAddress:
          $ref: '#/components/schemas/Address'
      additionalProperties: false
    InvoiceLine:
      required:
        - id
        - quantity
        - unitAmount
      type: object
      properties:
        id:
          type: string
          description: Gets the unique identifier of the invoice line.
          format: uuid
        sku:
          type: string
          nullable: true
          readOnly: true
        title:
          type: string
          nullable: true
          readOnly: true
        description:
          type: string
          nullable: true
          readOnly: true
        periodStart:
          type: string
          format: date
          nullable: true
          readOnly: true
        periodEnd:
          type: string
          format: date
          nullable: true
          readOnly: true
        quantity:
          type: number
          description: Quantity or count of units billed by the line. Precision to 4.
          format: double
        unitAmount:
          type: integer
          description: Unit amount (in the invoice currency specified) for the line.
          format: int64
        amount:
          type: integer
          description: >-
            Amount (in the invoice currency specified) for the line. This will
            always be equal to UnitAmount * Quantity - Discount.
          format: int64
          readOnly: true
        taxAmount:
          type: integer
          description: >-
            Amount of tax, if the line is taxable. Auto calculated as a
            percentage of the line amount based on the tax rate, see Tax.
          format: int64
          readOnly: true
        tax:
          $ref: '#/components/schemas/InvoiceLineTax'
        discount:
          $ref: '#/components/schemas/InvoiceLineDiscount'
      additionalProperties: false
    InvoiceSettlement:
      required:
        - amount
        - date
      type: object
      properties:
        date:
          type: string
          format: date
        amount:
          type: integer
          format: int64
        reference:
          type: string
          nullable: true
        note:
          type: string
          nullable: true
      additionalProperties: false
    InvoiceTypeEnum:
      enum:
        - invoice
        - credit_note
      type: string
    InvoiceSettlementStatus:
      enum:
        - settled
        - over_settled
        - under_settled
        - not_settled
      type: string
    Address:
      type: object
      properties:
        street1:
          type: string
          nullable: true
        street2:
          type: string
          nullable: true
        postalCode:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        county:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        state:
          type: string
          nullable: true
      additionalProperties: false
    InvoiceLineTax:
      type: object
      properties:
        taxable:
          type: boolean
          description: When true, tax is applied to the line. If false, tax is 0.
        taxCode:
          type: string
          description: Tax code.
          nullable: true
        taxRate:
          type: number
          description: Tax rate (percentage, 0.255 = 25.5%) for the line. Precision to 4.
          format: double
      additionalProperties: false
    InvoiceLineDiscount:
      type: object
      properties:
        percentage:
          type: number
          format: double
        amount:
          type: integer
          format: int64
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: http
      description: "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\""
      scheme: Bearer

````