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

# Check if a PDF is an invoice

> Cheap pre-flight check: is the uploaded PDF an energy invoice? Runs only the gate (no extraction), so a
caller can reject obviously-wrong uploads before paying for a full extraction.



## OpenAPI

````yaml /api-reference/swagger-partner.json post /api/v1/invoice-extraction/validate
openapi: 3.0.4
info:
  title: Partner API
  description: API for partner services
  version: v1
servers:
  - url: https://api.partner.cubee.cz
    description: Partnerý API server
security: []
tags:
  - name: Aggregated Data
  - name: Authentication
  - name: Calculator
  - name: CalculatorControllerV1
  - name: InvoiceExtraction
  - name: Public
  - name: Reference data
  - name: Studies
paths:
  /api/v1/invoice-extraction/validate:
    post:
      tags:
        - InvoiceExtraction
      summary: Check if a PDF is an invoice
      description: >-
        Cheap pre-flight check: is the uploaded PDF an energy invoice? Runs only
        the gate (no extraction), so a

        caller can reject obviously-wrong uploads before paying for a full
        extraction.
      operationId: Validate Invoice
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
            encoding:
              file:
                style: form
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/InvoiceValidationResponseModel'
              examples:
                energy-invoice:
                  summary: Recognised as an energy invoice
                  value:
                    fileName: vyuctovani-elektrina.pdf
                    isEnergyInvoice: true
                    confidence: 0.98
                    supplier: innogy Energie, s.r.o.
                    energyType: electricity
                    method: text
                scanned-invoice:
                  summary: Scanned invoice (image fallback)
                  value:
                    fileName: sken-faktury.pdf
                    isEnergyInvoice: true
                    confidence: 0.9
                    supplier: ČEZ Prodej, a.s.
                    energyType: electricity
                    method: document
                not-an-invoice:
                  summary: Not an energy invoice
                  value:
                    fileName: smlouva.pdf
                    isEnergyInvoice: false
                    confidence: 0.96
                    supplier: ''
                    energyType: ''
                    method: text
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceValidationResponseModel'
              examples:
                energy-invoice:
                  summary: Recognised as an energy invoice
                  value:
                    fileName: vyuctovani-elektrina.pdf
                    isEnergyInvoice: true
                    confidence: 0.98
                    supplier: innogy Energie, s.r.o.
                    energyType: electricity
                    method: text
                scanned-invoice:
                  summary: Scanned invoice (image fallback)
                  value:
                    fileName: sken-faktury.pdf
                    isEnergyInvoice: true
                    confidence: 0.9
                    supplier: ČEZ Prodej, a.s.
                    energyType: electricity
                    method: document
                not-an-invoice:
                  summary: Not an energy invoice
                  value:
                    fileName: smlouva.pdf
                    isEnergyInvoice: false
                    confidence: 0.96
                    supplier: ''
                    energyType: ''
                    method: text
            text/json:
              schema:
                $ref: '#/components/schemas/InvoiceValidationResponseModel'
              examples:
                energy-invoice:
                  summary: Recognised as an energy invoice
                  value:
                    fileName: vyuctovani-elektrina.pdf
                    isEnergyInvoice: true
                    confidence: 0.98
                    supplier: innogy Energie, s.r.o.
                    energyType: electricity
                    method: text
                scanned-invoice:
                  summary: Scanned invoice (image fallback)
                  value:
                    fileName: sken-faktury.pdf
                    isEnergyInvoice: true
                    confidence: 0.9
                    supplier: ČEZ Prodej, a.s.
                    energyType: electricity
                    method: document
                not-an-invoice:
                  summary: Not an energy invoice
                  value:
                    fileName: smlouva.pdf
                    isEnergyInvoice: false
                    confidence: 0.96
                    supplier: ''
                    energyType: ''
                    method: text
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
            text/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
            text/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProblemDetails'
                  - $ref: '#/components/schemas/HttpValidationProblemDetails'
        '500':
          description: Internal Server Error
        '503':
          description: Service Unavailable
      security:
        - {}
components:
  schemas:
    InvoiceValidationResponseModel:
      type: object
      properties:
        fileName:
          type: string
          description: Original file name of the uploaded document.
          nullable: true
        isEnergyInvoice:
          type: boolean
          description: >-
            True if the document is an energy supply invoice / vyúčtování /
            výkup (electricity or gas).
        confidence:
          type: number
          description: Model confidence in `isEnergyInvoice`, 0.0–1.0.
          format: double
        supplier:
          type: string
          description: Supplier name if recognised, otherwise empty.
          nullable: true
        energyType:
          type: string
          description: electricity | gas | both | "" (unknown / not an invoice).
          nullable: true
        method:
          type: string
          description: >-
            How the verdict was reached: "text" (page-1 text, the cheap path) or
            "document" (image fallback for scans).
          nullable: true
      additionalProperties: false
      description: >-
        Result of the cheap pre-flight check on an uploaded PDF — "is this
        actually a Czech energy invoice?" — without

        running the full extraction. Lets a caller (e.g. the eshop) reject
        obviously-wrong uploads before paying for

        extraction.
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    HttpValidationProblemDetails:
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          properties:
            errors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
              nullable: true
          additionalProperties: {}

````