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

# Create invoice audit

> Upload a carrier invoice and audit it against the rates and surcharges of an existing contract. Returns immediately with `status=PENDING`; auditing runs asynchronously. Poll `GET /v1/invoice-audits` until `status=COMPLETE` to retrieve findings.

Accepted file formats: PDF, CSV.



## OpenAPI

````yaml POST /v1/invoice-audits
openapi: 3.1.0
info:
  title: Opereit Invoice Auditing API
  description: >-
    Public API for the Opereit Invoice Auditing product. Upload carrier
    contracts, run audits against incoming carrier invoices, and retrieve line
    items and findings.
  version: 1.0.0
servers:
  - url: https://api.opereit.com
    description: Production
security:
  - apiKey: []
paths:
  /v1/invoice-audits:
    post:
      summary: Create an invoice audit
      description: >-
        Upload a carrier invoice and audit it against the rates and surcharges
        of an existing contract. Returns immediately with `status=PENDING`;
        auditing runs asynchronously. Poll `GET /v1/invoice-audits` until
        `status=COMPLETE` to retrieve findings.


        Accepted file formats: PDF, CSV.
      operationId: createInvoiceAudit
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - contract_id
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The carrier invoice document. Accepted MIME types:
                    `application/pdf`, `text/csv`.
                contract_id:
                  type: string
                  description: ID of the contract to audit this invoice against.
      responses:
        '201':
          description: Audit created. Auditing runs asynchronously.
          content:
            application/json:
              schema:
                type: object
                properties:
                  audit:
                    $ref: '#/components/schemas/InvoiceAudit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    InvoiceAudit:
      type: object
      description: An audit of a carrier invoice against a contract.
      required:
        - id
        - contract_id
        - status
        - created_at
      properties:
        id:
          type: string
        contract_id:
          type: string
          description: Contract this invoice was audited against.
        carrier_name:
          type:
            - string
            - 'null'
          description: Carrier name (denormalized from the contract for convenience).
        status:
          type: string
          enum:
            - PENDING
            - INGESTING
            - AUDITING
            - COMPLETE
            - FAILED
          description: |-
            Audit lifecycle state.

            - `PENDING`: queued for processing.
            - `INGESTING`: parsing the invoice file.
            - `AUDITING`: running audit rules.
            - `COMPLETE`: line items and findings are available.
            - `FAILED`: audit failed; see `status_reason`.
        status_reason:
          type:
            - string
            - 'null'
          description: Explanation when `status=FAILED`.
        total_line_items:
          type:
            - integer
            - 'null'
          description: >-
            Total line items extracted from the invoice. `null` until ingestion
            completes.
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the audit reached a terminal state (`COMPLETE` or `FAILED`).
        created_at:
          type: string
          format: date-time
          description: When the audit was created.
        file:
          oneOf:
            - $ref: '#/components/schemas/InvoiceAuditFile'
            - type: 'null'
          description: Metadata about the uploaded invoice file.
    InvoiceAuditFile:
      type: object
      description: Metadata about the invoice document uploaded for an audit.
      required:
        - id
        - file_url
        - file_name
        - original_file_name
        - created_at
      properties:
        id:
          type: string
        file_url:
          type: string
          format: uri
          description: Time-limited URL to download the original invoice file.
        file_name:
          type: string
          description: Storage filename.
        original_file_name:
          type: string
          description: Filename as uploaded by the client.
        file_size_bytes:
          type:
            - integer
            - 'null'
          description: File size in bytes.
        invoice_number:
          type:
            - string
            - 'null'
          description: Carrier invoice number, extracted from the document.
        invoice_date:
          type:
            - string
            - 'null'
          format: date
          description: Date on the invoice, extracted from the document.
        account_number:
          type:
            - string
            - 'null'
          description: Carrier account number on the invoice.
        billing_period_start:
          type:
            - string
            - 'null'
          format: date
          description: Start of the billing period covered by the invoice.
        billing_period_end:
          type:
            - string
            - 'null'
          format: date
          description: End of the billing period covered by the invoice.
        currency:
          type:
            - string
            - 'null'
          description: ISO 4217 currency code the invoice is denominated in.
        created_at:
          type: string
          format: date-time
          description: When the invoice was uploaded.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: basic
      description: >-
        HTTP Basic Auth using your API key. Send `Authorization: Basic
        base64(key_id:key_secret)`.

````