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

# Generate an invoice

> Generate an invoice for a customer given a contract



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /invoices/generate_invoice
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /invoices/generate_invoice:
    post:
      tags:
        - Invoices
      summary: Generate an invoice
      description: Generate an invoice for a customer given a contract
      operationId: Generate-an-invoice
      parameters:
        - name: apiversion
          in: header
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Apiversion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateInvoiceRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GenerateInvoiceRequestSchema:
      properties:
        customer_id:
          type: string
          format: uuid
          title: Customer Id
          description: Customer Id
        contract_id:
          type: string
          format: uuid
          title: Contract Id
          description: Contract Id
        from_date:
          type: string
          format: date-time
          title: From Date
          description: Unix time stamp of From Date
        to_date:
          type: string
          format: date-time
          title: To Date
          description: Unix time stamp of To Date
        check_duplicate_invoice:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Check Duplicate Invoice
          description: Check for duplicate invoice in same billing period
        bill_for_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Bill For Date
          description: Bill for date for invoice generation
        billing_cycle_start_day:
          anyOf:
            - type: integer
            - type: 'null'
          title: Billing Cycle Start Day
          description: Day of the month on which invoice generation should take place
      type: object
      required:
        - customer_id
        - contract_id
        - from_date
        - to_date
      title: GenerateInvoiceRequestSchema
      description: Generate Invoice Request Schema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````