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

# Get invoice summary statistics

> Takes the same filters as the invoice list and summarises every matching invoice, not just one page. Amounts are in the tenant base currency (each invoice scaled by its exchange rate); cancelled invoices are counted only in the `cancelled_*` figures.



## OpenAPI

````yaml /api-referansi/openapi.json get /v1/invoices/stats
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/invoices/stats:
    get:
      tags:
        - Invoice
      summary: Get invoice summary statistics
      description: >-
        Takes the same filters as the invoice list and summarises every matching
        invoice, not just one page. Amounts are in the tenant base currency
        (each invoice scaled by its exchange rate); cancelled invoices are
        counted only in the `cancelled_*` figures.
      operationId: invoice.stats
      parameters:
        - name: search
          in: query
          description: The search query.
          schema:
            type:
              - string
              - 'null'
            maxLength: 255
        - name: status
          in: query
          description: Filter by status.
          schema:
            type:
              - string
              - 'null'
            enum:
              - draft
              - success
              - sent
              - waiting
              - error
              - cancelled
              - null
        - name: is_archived
          in: query
          description: Filter by archived status.
          schema:
            type:
              - boolean
              - 'null'
        - name: is_draft
          in: query
          description: Filter by draft status.
          schema:
            type:
              - boolean
              - 'null'
        - name: is_cancelled
          in: query
          description: Filter by cancelled status.
          schema:
            type:
              - boolean
              - 'null'
        - name: document_class
          in: query
          description: Filter by document class (EFATURA, EARSIV or SMM).
          schema:
            type:
              - string
              - 'null'
            enum:
              - EFATURA
              - EARSIV
              - SMM
              - null
        - name: sale_id
          in: query
          description: Filter by the sale the invoice belongs to.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: customer_id
          in: query
          description: Filter by the customer the invoice belongs to.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: issue_date_from
          in: query
          description: Filter records from this issue date (inclusive, YYYY-MM-DD).
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: issue_date_to
          in: query
          description: Filter records up to this issue date (inclusive, YYYY-MM-DD).
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      currency:
                        type: string
                      '':
                        type: object
                    required:
                      - currency
                      - null
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.flextell.ai/oauth/authorize
          tokenUrl: https://app.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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