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

# Create Credit Note

> Credit against a finalized invoice.

Only against a `FINALIZED` invoice; total must be > 0 and ≤ the invoice balance.
Body:

```json theme={null}
{
  "reason": "billing_error",
  "notes": "optional",
  "items": [ { "fee_id": 1, "description": "Refund toll", "amount": "10.00" } ],
  "attachments": [ { "type": "tolls", "id": 55 } ]
}
```

`reason` ∈ `duplicated_charge`, `billing_error`, `dispute`, `goodwill`, `other`.
`fee_id` (optional) must reference a fee on that invoice. `attachments[].type` ∈
`tolls`, `citations`. Returns `201`; the PDF is generated asynchronously.


## OpenAPI

````yaml post /v2/driver-invoices/{id}/credit-notes/
openapi: 3.0.3
info:
  title: Fleet IT Customer API
  version: 2.0.0
  description: >-
    Public API for Fleet IT platform customers.


    For detailed guides, authentication setup, error codes, and integration
    examples, see the [Fleet IT
    Documentation](https://docs.fleetit.com/documentation/overview).


    ## Headers


    All authenticated endpoints accept an optional `Fleet-Id` header (integer)
    to specify which fleet to operate on. If omitted, the user's default fleet
    is used.
servers: []
security:
  - JWT: []
  - APIKey: []
externalDocs:
  url: https://docs.fleetit.com/documentation/overview
  description: Fleet IT Documentation
paths:
  /v2/driver-invoices/{id}/credit-notes/:
    post:
      tags:
        - Driver Billing (v2)
      operationId: v2_driver_invoices_credit_notes_create
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DriverInvoice'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DriverInvoice'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DriverInvoice'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DriverInvoice'
          description: ''
components:
  schemas:
    DriverInvoice:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        invoice_number:
          type: string
          readOnly: true
        agreement:
          allOf:
            - $ref: '#/components/schemas/InvoiceAgreement'
          readOnly: true
        driver:
          allOf:
            - $ref: '#/components/schemas/InvoiceDriver'
          readOnly: true
        fleet:
          type: integer
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/StatusB11Enum'
          readOnly: true
        trigger:
          allOf:
            - $ref: '#/components/schemas/TriggerEnum'
          readOnly: true
        plan_snapshot:
          readOnly: true
          description: Full snapshot of plan + charges at creation time.
        grace_period_ends_at:
          type: string
          format: date-time
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        finalized_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        payment_due_date:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        is_overdue:
          type: boolean
          readOnly: true
        total:
          type: string
          format: decimal
          pattern: ^-?\d{0,10}(?:\.\d{0,2})?$
          readOnly: true
          nullable: true
          description: Null during DRAFT; computed and locked on finalization.
        draft_total:
          type: string
          format: decimal
          pattern: ^-?\d{0,10}(?:\.\d{0,2})?$
          readOnly: true
          nullable: true
          description: Materialized running total while in DRAFT; nulled on finalization.
        credited_amount:
          type: number
          format: double
          readOnly: true
        balance:
          type: number
          format: double
          readOnly: true
        payment_status:
          $ref: '#/components/schemas/PaymentStatusAffEnum'
        pdf_status:
          readOnly: true
          nullable: true
          description: |-
            Null = PDF never requested. Set to PENDING when task is enqueued.

            * `PENDING` - Pending
            * `IN_PROGRESS` - In Progress
            * `COMPLETE` - Complete
          oneOf:
            - $ref: '#/components/schemas/PdfStatusEnum'
            - $ref: '#/components/schemas/NullEnum'
        pdf_file:
          type: string
          format: uri
          readOnly: true
          nullable: true
        fees:
          type: string
          readOnly: true
        fee_adjustments:
          type: array
          items:
            $ref: '#/components/schemas/DriverInvoiceFeeAdjustment'
          readOnly: true
        tickets:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceTicket'
          readOnly: true
        exchanges:
          type: string
          readOnly: true
      required:
        - agreement
        - balance
        - created_at
        - credited_amount
        - draft_total
        - driver
        - exchanges
        - fee_adjustments
        - fees
        - finalized_at
        - fleet
        - grace_period_ends_at
        - id
        - invoice_number
        - is_overdue
        - payment_due_date
        - pdf_file
        - pdf_status
        - plan_snapshot
        - status
        - tickets
        - total
        - trigger
    InvoiceAgreement:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        vehicle:
          allOf:
            - $ref: '#/components/schemas/InvoiceVehicle'
          readOnly: true
        driver:
          allOf:
            - $ref: '#/components/schemas/InvoiceDriver'
          readOnly: true
        status:
          type: string
          readOnly: true
        agreement_status:
          $ref: '#/components/schemas/AgreementStatusEnum'
        agreement_start_date:
          type: string
          format: date-time
        agreement_end_date:
          type: string
          format: date-time
          nullable: true
        date_added:
          type: string
          format: date-time
          readOnly: true
        last_updated:
          type: string
          format: date-time
          readOnly: true
        agreement_number:
          type: string
          maxLength: 255
        plan:
          type: string
          nullable: true
          maxLength: 255
        billing_plan:
          type: integer
          nullable: true
      required:
        - agreement_number
        - agreement_start_date
        - date_added
        - driver
        - id
        - last_updated
        - status
        - vehicle
    InvoiceDriver:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        driver_id:
          type: string
          nullable: true
          maxLength: 255
        first_name:
          type: string
          maxLength: 100
        last_name:
          type: string
          maxLength: 100
        address_line_1:
          type: string
          maxLength: 100
        address_line_2:
          type: string
          nullable: true
          maxLength: 100
        city:
          type: string
          maxLength: 50
        state:
          type: string
          maxLength: 2
        zip:
          type: string
          maxLength: 10
          minLength: 5
        contact_number:
          type: string
          nullable: true
          maxLength: 15
        email:
          type: array
          items:
            type: string
            format: email
            maxLength: 255
      required:
        - address_line_1
        - city
        - first_name
        - id
        - zip
    StatusB11Enum:
      enum:
        - DRAFT
        - FINALIZED
        - VOID
      type: string
      description: |-
        * `DRAFT` - Draft
        * `FINALIZED` - Finalized
        * `VOID` - Void
    TriggerEnum:
      enum:
        - PROGRESSIVE
        - AGREEMENT_ENDED
        - LATE_TICKET
        - MANUAL
      type: string
      description: |-
        * `PROGRESSIVE` - Progressive
        * `AGREEMENT_ENDED` - Agreement Ended
        * `LATE_TICKET` - Late Ticket
        * `MANUAL` - Manual
    PaymentStatusAffEnum:
      enum:
        - PENDING
        - SUCCEEDED
        - FAILED
      type: string
      description: |-
        * `PENDING` - Pending
        * `SUCCEEDED` - Succeeded
        * `FAILED` - Failed
    PdfStatusEnum:
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETE
      type: string
      description: |-
        * `PENDING` - Pending
        * `IN_PROGRESS` - In Progress
        * `COMPLETE` - Complete
    NullEnum:
      enum:
        - null
    DriverInvoiceFeeAdjustment:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        charge_snapshot_index:
          type: integer
          maximum: 2147483647
          minimum: 0
          description: >-
            Index into plan_snapshot['charges'] — identifies which fee this
            adjusts.
        override_quantity:
          type: string
          format: decimal
          pattern: ^-?\d{0,10}(?:\.\d{0,2})?$
          nullable: true
        override_unit_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
          nullable: true
          description: If set, replaces the computed unit amount for this fee.
        original_quantity:
          type: string
          format: decimal
          pattern: ^-?\d{0,10}(?:\.\d{0,2})?$
          readOnly: true
        original_unit_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
          readOnly: true
          nullable: true
          description: Captured at adjustment creation for audit trail.
        reason:
          type: string
        created_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - charge_snapshot_index
        - created_at
        - id
        - original_quantity
        - original_unit_amount
    InvoiceTicket:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
          readOnly: true
        transaction_date:
          type: string
          format: date
        exit_time:
          type: string
          format: time
        exit_plaza:
          type: string
          readOnly: true
        agency:
          type: string
          readOnly: true
        driver_agreement:
          type: integer
          nullable: true
      required:
        - agency
        - amount
        - exit_plaza
        - exit_time
        - id
        - transaction_date
    InvoiceVehicle:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        plate_number:
          type: string
          maxLength: 15
        plate_state:
          type: string
          default: NY
          maxLength: 4
        vehicle_number:
          type: string
          maxLength: 20
        vehicle_make:
          type: string
          nullable: true
          maxLength: 50
        vehicle_model:
          type: string
          nullable: true
          maxLength: 50
        year:
          type: string
          nullable: true
          maxLength: 5
      required:
        - id
        - plate_number
    AgreementStatusEnum:
      enum:
        - ACTIVE
        - INACTIVE
      type: string
      description: |-
        * `ACTIVE` - Active
        * `INACTIVE` - In-active
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
    APIKey:
      type: apiKey
      in: header
      name: Authorization

````