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

# Create draft invoice

> Requires `write:billing`. Creates a one-off invoice **as a draft** for a customer, from one-time products (default or chosen price, or a custom amount) and/or custom lines (`description` + `amountCents`), with an optional car per line, due date and memo. Nothing is sent or charged; sending is a separate action, and staff can also finish it at `dashboardUrl`. Tax and processing fees follow the facility's settings.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/billing/invoices
openapi: 3.0.0
info:
  title: Car Storage Software API
  version: 1.2.0
  description: >-
    Team-scoped REST API for Car Storage Software. Authenticate with a team API
    key (`Authorization: Bearer <key>` or `x-api-key: <key>`) created under
    Settings → Integrations → API. Keys carry granular `read:*` / `write:*`
    scopes; read never implies write.
servers:
  - url: https://www.carstoragesoftware.com
security: []
paths:
  /api/v1/billing/invoices:
    post:
      tags:
        - Billing
      summary: Create draft invoice
      description: >-
        Requires `write:billing`. Creates a one-off invoice **as a draft** for a
        customer, from one-time products (default or chosen price, or a custom
        amount) and/or custom lines (`description` + `amountCents`), with an
        optional car per line, due date and memo. Nothing is sent or charged;
        sending is a separate action, and staff can also finish it at
        `dashboardUrl`. Tax and processing fees follow the facility's settings.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
                  format: uuid
                  description: Customer id from `list_customers`.
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      productId:
                        type: string
                        format: uuid
                        description: >-
                          One-time product (from `list_billing_products`, type
                          `one_off`).
                      priceId:
                        type: string
                        format: uuid
                        description: >-
                          One of the product's prices; defaults to the product's
                          price.
                      description:
                        type: string
                        minLength: 1
                        maxLength: 500
                        description: >-
                          Line text. Required for a custom line (no productId),
                          e.g. `Battery tender install`.
                      amountCents:
                        type: integer
                        minimum: 1
                        maximum: 10000000
                        description: >-
                          Unit price in cents, before tax and processing fees.
                          Required for a custom line; with a productId it
                          overrides the product's price.
                      quantity:
                        type: integer
                        minimum: 1
                        maximum: 100
                      carId:
                        type: string
                        format: uuid
                        description: Car this line is for.
                  minItems: 1
                  maxItems: 25
                dueDate:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                  description: >-
                    Due date (YYYY-MM-DD). Defaults to the facility's usual
                    terms.
                memo:
                  type: string
                  maxLength: 500
                  description: Note shown on the invoice.
              required:
                - customerId
                - items
      responses:
        '201':
          description: Draft invoice created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1BillingInvoiceCreated'
        '401':
          description: Missing, invalid, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: API key missing required scope, or API disabled for team.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: >-
            Payments aren't set up for this facility (no connected Stripe
            account).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    V1BillingInvoiceCreated:
      type: object
      properties:
        data:
          allOf:
            - $ref: '#/components/schemas/V1BillingInvoice'
            - type: object
              properties:
                dashboardUrl:
                  type: string
                  description: The draft in Payments, where staff can review and send it.
              required:
                - dashboardUrl
      required:
        - data
    ApiError:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        details:
          nullable: true
      required:
        - error
    V1BillingInvoice:
      type: object
      properties:
        id:
          type: string
          description: Stripe invoice id (`in_…`).
        number:
          type: string
          nullable: true
        customerId:
          type: string
          nullable: true
          format: uuid
          description: Car Storage Software customer id, when linked.
        status:
          type: string
          nullable: true
          description: '`draft`, `open`, `paid`, `void`, or `uncollectible`.'
        currency:
          type: string
        totalCents:
          type: integer
        amountDueCents:
          type: integer
        amountPaidCents:
          type: integer
        amountRemainingCents:
          type: integer
        dueDate:
          type: string
          nullable: true
          format: date-time
        createdAt:
          type: string
          nullable: true
          format: date-time
        paidAt:
          type: string
          nullable: true
          format: date-time
        hostedInvoiceUrl:
          type: string
          nullable: true
        subscriptionId:
          type: string
          nullable: true
          description: Stripe subscription id, when recurring.
        lines:
          type: array
          items:
            type: object
            properties:
              description:
                type: string
                nullable: true
              amountCents:
                type: integer
              quantity:
                type: integer
                nullable: true
            required:
              - description
              - amountCents
              - quantity
      required:
        - id
        - number
        - customerId
        - status
        - currency
        - totalCents
        - amountDueCents
        - amountPaidCents
        - amountRemainingCents
        - dueDate
        - createdAt
        - paidAt
        - hostedInvoiceUrl
        - subscriptionId
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Team API key from Settings → Integrations. Use `Authorization: Bearer
        <key>` or `x-api-key`.

````

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