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

# Create an Invoice

> Create an Invoice



## OpenAPI

````yaml /api-reference/openapi.json post /v1/invoices
openapi: 3.0.3
info:
  title: Bookeeping.ai API
  version: 1.0.0
  description: API for accessing and managing bookkeeping.ai data.
servers:
  - url: https://api.bookeeping.ai/public-api
    description: USA Virginia Region
  - url: https://ca-api.bookeeping.ai/public-api
    description: Canada Toronto Region
  - url: https://eu-api.bookeeping.ai/public-api
    description: EU Belgium Region
security:
  - BearerAuth: []
paths:
  /v1/invoices:
    post:
      tags:
        - Invoices
      summary: Create an Invoice
      description: Create an Invoice
      operationId: createInvoice
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                purchaseOrderId:
                  type: string
                  nullable: true
                  description: The id of the purchase order
                discount:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - PERCENTAGE
                        - FIXED
                    value:
                      type: number
                  required:
                    - type
                    - value
                  additionalProperties: false
                  description: Global discount, after applying the line item discounts
                invoiceDate:
                  type: string
                  format: date-time
                  description: The date of the invoice
                dueDate:
                  type: string
                  format: date-time
                  description: The date of the due date
                lineItems:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      description:
                        type: string
                      quantity:
                        type: number
                      unitPrice:
                        type: number
                      tax:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - PERCENTAGE
                              - FIXED
                          value:
                            type: number
                        required:
                          - type
                          - value
                        additionalProperties: false
                      discount:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - PERCENTAGE
                              - FIXED
                          value:
                            type: number
                        required:
                          - type
                          - value
                        additionalProperties: false
                    required:
                      - id
                      - name
                      - quantity
                      - unitPrice
                      - tax
                      - discount
                    additionalProperties: false
                  description: The line items of the invoice
                payViaStripeAccountConnectionId:
                  type: string
                  pattern: ^[0-9A-Fa-f]{24}$
                  description: >-
                    The id of the pay via stripe account connection. Expected to
                    be a valid object id like 666666666666666666666666
                  nullable: true
                note:
                  type: string
                  description: The notes of the invoice
                counterParty:
                  type: string
                  pattern: ^[0-9A-Fa-f]{24}$
                  description: >-
                    The id of the counterparty. Expected to be a valid object id
                    like 666666666666666666666666
                invoiceId:
                  anyOf:
                    - type: string
                    - type: string
                      enum:
                        - INCREMENTAL
                  description: >-
                    The id of the invoice or 'INCREMENTAL' to auto generate the
                    invoice id
                currency:
                  type: string
                  description: The currency of the invoice.
              required:
                - discount
                - invoiceDate
                - dueDate
                - lineItems
                - note
                - counterParty
                - invoiceId
                - currency
              additionalProperties: false
      responses:
        '200':
          description: Create an Invoice executed successfully
          headers:
            x-rate-limiter-daily-limit:
              description: Maximum number of requests allowed per day
              schema:
                type: integer
                example: 1500
            x-rate-limiter-minutely-limit:
              description: Maximum number of requests allowed per minute
              schema:
                type: integer
                example: 25
            x-rate-limiter-daily-usage:
              description: Number of requests made today
              schema:
                type: integer
                example: 106
            x-rate-limiter-minutely-usage:
              description: Number of requests made in the current minute
              schema:
                type: integer
                example: 1
            x-rate-limiter-operation-type:
              description: Operation type. Either read or write.
              schema:
                type: string
                enum:
                  - read
                  - write
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Success message
                  metaData:
                    type: object
                    properties:
                      warnings:
                        type: array
                        items:
                          type: string
                        description: Any validation warnings
                  data:
                    type: object
                    properties:
                      _id:
                        type: string
                        description: The id of the invoice
                      projectId:
                        type: string
                        description: The id of the project
                      status:
                        type: string
                        enum:
                          - DRAFT
                          - SENT
                          - PAID
                          - OVERDUE
                          - CANCELLED
                        description: The status of the invoice
                      invoiceId:
                        type: string
                        description: The number of the invoice eg. 0001, 0002, etc.
                      purchaseOrderId:
                        type: string
                        nullable: true
                        description: The id of the purchase order
                      counterParty:
                        type: object
                        properties:
                          _id:
                            type: string
                            description: The id of the counterparty
                          accountName:
                            type: string
                            nullable: true
                            description: The account name of the counterparty
                          accountNumber:
                            type: string
                            nullable: true
                            description: The account number of the counterparty
                          email:
                            type: string
                            format: email
                            nullable: true
                            description: The email of the counterparty
                          phone:
                            type: string
                            nullable: true
                            description: The phone of the counterparty
                          type:
                            type: string
                            enum:
                              - customer
                              - vendor
                              - both
                            nullable: true
                            description: The type of the counterparty
                          otherEmails:
                            type: array
                            items:
                              type: string
                              format: email
                            nullable: true
                            description: The other emails of the counterparty
                          address:
                            type: object
                            properties:
                              city:
                                type: string
                                nullable: true
                              country:
                                type: string
                                nullable: true
                              state:
                                type: string
                                nullable: true
                              cca2:
                                type: string
                                nullable: true
                              line1:
                                type: string
                                nullable: true
                              line2:
                                type: string
                                nullable: true
                              postalCode:
                                type: string
                                nullable: true
                            additionalProperties: false
                            nullable: true
                            description: The address of the counterparty
                        required:
                          - _id
                        additionalProperties: false
                        nullable: true
                        description: The counterparty of the invoice
                      discount:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - PERCENTAGE
                              - FIXED
                          value:
                            type: number
                        required:
                          - type
                          - value
                        additionalProperties: false
                        description: >-
                          Global discount, after applying the line item
                          discounts
                      amount:
                        type: number
                        description: The amount of the invoice
                      convertedAmount:
                        type: number
                        nullable: true
                        description: The converted amount of the invoice
                      convertedCurrency:
                        type: string
                        nullable: true
                        description: The converted currency of the invoice
                      sendDate:
                        type: string
                        format: date-time
                        nullable: true
                        description: The date of the sending
                      sendBy:
                        type: string
                        nullable: true
                        description: The user who sent the invoice
                      invoiceDate:
                        type: string
                        format: date-time
                        description: The date of the invoice
                      dueDate:
                        type: string
                        format: date-time
                        description: The date of the due date
                      currency:
                        type: string
                        description: The currency of the invoice
                      lineItems:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            name:
                              type: string
                            description:
                              type: string
                            quantity:
                              type: number
                            unitPrice:
                              type: number
                            tax:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - PERCENTAGE
                                    - FIXED
                                value:
                                  type: number
                              required:
                                - type
                                - value
                              additionalProperties: false
                            discount:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - PERCENTAGE
                                    - FIXED
                                value:
                                  type: number
                              required:
                                - type
                                - value
                              additionalProperties: false
                          required:
                            - id
                            - name
                            - quantity
                            - unitPrice
                            - tax
                            - discount
                          additionalProperties: false
                        description: The line items of the invoice
                      note:
                        type: string
                        description: The notes of the invoice
                      calculated:
                        type: object
                        properties:
                          grandTotal:
                            type: number
                            description: The grand total of the invoice
                          tax:
                            type: number
                            description: The tax of the invoice
                          discount:
                            type: number
                            description: The discount of the invoice
                          subTotal:
                            type: number
                            description: The sub total of the invoice
                        required:
                          - grandTotal
                          - tax
                          - discount
                          - subTotal
                        additionalProperties: false
                      cancellationReason:
                        type: string
                        nullable: true
                        description: The reason of the cancellation
                      cancellationDate:
                        type: string
                        format: date-time
                        nullable: true
                        description: The date of the cancellation
                      cancellationBy:
                        type: string
                        nullable: true
                        description: The user who cancelled the invoice
                      paidMarkedBy:
                        type: string
                        nullable: true
                        description: The user who marked the invoice as paid
                      paidMarkedDate:
                        type: string
                        format: date-time
                        nullable: true
                        description: The date of the payment
                      attachedTransactionId:
                        type: string
                        nullable: true
                        description: The id of the transaction attached to the invoice
                      attachments:
                        type: array
                        items:
                          type: string
                        description: The attachments of the invoice
                      payViaStripeAccountConnectionId:
                        type: string
                        pattern: ^[0-9A-Fa-f]{24}$
                        description: >-
                          The id of the pay via stripe account connection.
                          Expected to be a valid object id like
                          666666666666666666666666
                        nullable: true
                      createdAt:
                        type: string
                        format: date-time
                        description: The date of the creation
                      updatedAt:
                        type: string
                        format: date-time
                        description: The date of the last update
                    required:
                      - _id
                      - projectId
                      - status
                      - invoiceId
                      - discount
                      - amount
                      - invoiceDate
                      - dueDate
                      - currency
                      - lineItems
                      - note
                      - calculated
                      - attachments
                      - createdAt
                      - updatedAt
                    additionalProperties: false
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - BadRequestError
                  message:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - UnauthorizedError
                  message:
                    type: string
        '409':
          description: Conflict - Resource already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - ConflictError
                  message:
                    type: string
        '429':
          description: >-
            Too Many Requests - Rate limit exceeded. Either daily or minutely
            limit exceeded. If you have any questions, please contact
            support@bookeeping.ai.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - TooManyRequestsError
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API key for authentication. Get your key from the Dashboard > Settings >
        API Access.

````