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

# Buyurtmalar soni

> Buyurtmalar bo'yicha savdo statistikasi

## Umumiy ko'rinish

**Orders Count API** tanlangan davrda aniq kompaniya uchun yig'ilgan savdo ma'lumotlarini olish uchun ishlatiladi.

Bu endpoint buyurtmalarning umumiy soni va umumiy savdo summasini qaytaradi
based on the provided filters.

***

## Avtorizatsiya

🔓 This endpoint **requires authentication**.

**Header:**

Authorization: Token `<token_value>`

Token `Token` prefiksi va bo'sh joy bilan yuborilishi kerak.

***

## So'rov parametrlari

| Parametr     | Turi   | Majburiy | Tavsif                                                                                            |
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `start_date` | string | ✅        | Start date in ISO 8601 format (`YYYY-MM-DDTHH:MM:SS`). The `T` between date and time is mandatory |
| `end_date`   | string | ✅        | End date in ISO 8601 format (`YYYY-MM-DDTHH:MM:SS`). The `T` between date and time is mandatory   |
| `inn`        | string | ✅        | Company INN (Tax Identification Number)                                                           |

***

## Javob maydonlari

### ✅ Muvaffaqiyatli javob `200`

| Maydon               | Turi    | Tavsif                         |
| -------------------- | ------- | ------------------------------ |
| `status`             | string  | So'rov holati (`successfully`) |
| `filters`            | object  | Applied filters                |
| `filters.start_date` | string  | Start date                     |
| `filters.end_date`   | string  | End date                       |
| `filters.inn`        | string  | Company INN                    |
| `data`               | object  | Aggregated sales data          |
| `data.company_name`  | string  | Company name                   |
| `data.total_orders`  | integer | Total number of orders         |
| `data.total_amount`  | number  | Total sales amount             |

***

### 🚫 Xatolik javobi `400`

| Maydon    | Turi   | Tavsif                     |
| --------- | ------ | -------------------------- |
| `status`  | string | Error status               |
| `message` | string | O'qilishi oson xato xabari |


## OpenAPI

````yaml GET /api/v1/orders/count/
openapi: 3.1.0
info:
  title: Orders Count API
  description: Retrieve aggregated sales statistics for orders
  version: 1.0.0
servers:
  - url: https://api.fbox.uz
security: []
paths:
  /api/v1/orders/count/:
    get:
      tags:
        - Orders
      summary: Get orders count and total amount
      operationId: getOrdersCount
      parameters:
        - name: start_date
          in: query
          required: true
          schema:
            type: string
            example: '2025-05-05T00:00:00'
          description: Start date in ISO 8601 format (YYYY-MM-DDTHH:MM:SS)
        - name: end_date
          in: query
          required: true
          schema:
            type: string
            example: '2025-05-05T23:59:59'
          description: End date in ISO 8601 format (YYYY-MM-DDTHH:MM:SS)
        - name: inn
          in: query
          required: true
          schema:
            type: string
            example: '306429662'
          description: Company Tax Identification Number (INN)
      responses:
        '200':
          description: Orders statistics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersCountResponse'
              example:
                status: successfully
                filters:
                  start_date: '2025-05-05T00:00:00'
                  end_date: '2025-05-05T23:59:59'
                  inn: '354368473'
                data:
                  company_name: BAR CODE TECHNOLOGIES
                  total_orders: 2
                  total_amount: 700
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - TokenAuth: []
components:
  schemas:
    OrdersCountResponse:
      type: object
      properties:
        status:
          type: string
          example: successfully
        filters:
          type: object
          properties:
            start_date:
              type: string
            end_date:
              type: string
            inn:
              type: string
        data:
          type: object
          properties:
            company_name:
              type: string
            total_orders:
              type: integer
            total_amount:
              type: number
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Authorization token. Format: Token <token_value>'

````