Skip to content

Kpi settings ​

Employee KPI configuration

INFO

Har bir javob umumiy konvertda qaytadi — code, message, messages, status_code, time — foydali yuk esa data ichida. Quyidagi jadvallar faqat data ichini tavsiflaydi.

POST /kpi-settings/create ​

Create a new KPI settings record for a given period and set of employees.

So‘rov tanasi

MaydonTurMajburiyTavsif
organization_idstringHaOrganization ObjectId this KPI setting belongs to
namestringYo‘qOptional display name for the KPI setting
currency_idstringHaCurrency ObjectId used for monetary KPI metrics
user_idsstring[]HaObjectIds of the employees this KPI setting applies to
periodstringHaKPI evaluation period. Mumkin qiymatlar: week, month, quarter, year
calculation_methodstringHaHow the bonus is calculated across tiers: progressive (each tier adds to the previous) or threshold (only the matched tier applies). Mumkin qiymatlar: progressive, threshold
date_fromstring (date-time)HaStart date of the KPI period
date_tostring (date-time)HaEnd date of the KPI period
yearnumberHaCalendar year of the KPI period
quarterstringYo‘qQuarter label (e.g. Q1) when period is quarter
monthstringYo‘qMonth label when period is month
weekstringYo‘qWeek label when period is week
filter_enabledbooleanYo‘qWhether product/customer filters are active for this KPI setting. Standart: false
filterobjectYo‘qOptional product and customer scope filters
filter.is_all_categoriesbooleanYo‘q
filter.customer_category_idsstring[]Yo‘qCustomer category ObjectIds to include
filter.customer_nested_category_idsstring[]Yo‘q
filter.customer_idsstring[]Yo‘qSpecific customer ObjectIds to include
filter.product_category_idsstring[]Yo‘q
filter.product_nested_category_idsstring[]Yo‘q
filter.product_idsstring[]Yo‘qSpecific product ObjectIds to include
conditionsobject[]HaOne or more KPI plan conditions defining the performance metric and tier thresholds
conditions[].logical_operatorbooleanHatrue = AND with the next condition, false = OR
conditions[].source_metric_codestringHaThe performance metric used to evaluate this condition. Mumkin qiymatlar: net_sales, sales_count, avg_net_sales, profit, paid, paid_percent, items_sold
conditions[].tiersobject[]HaThreshold tiers for this condition
conditions[].tiers[].min_valuenumberHaMinimum metric value for this tier to activate
conditions[].tiers[].max_valuenumberYo‘qMaximum metric value for this tier (omit for the top tier)
bonus_metric_codestringHaHow the bonus amount is computed from the employee's results. Mumkin qiymatlar: percent_of_net_sales, percent_of_payment, percent_of_profit, per_sale, fixed_amount, per_item_sold
bonusesnumber[]HaBonus amounts or percentages, one entry per tier in the conditions
json
{
  "organization_id": "string",
  "name": "string",
  "currency_id": "string",
  "user_ids": [
    "string"
  ],
  "period": "week",
  "calculation_method": "progressive",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "year": 0,
  "quarter": "string",
  "month": "string",
  "week": "string",
  "filter_enabled": false,
  "filter": {
    "is_all_categories": false,
    "customer_category_ids": [
      "string"
    ],
    "customer_nested_category_ids": [
      "string"
    ],
    "customer_ids": [
      "string"
    ],
    "product_category_ids": [
      "string"
    ],
    "product_nested_category_ids": [
      "string"
    ],
    "product_ids": [
      "string"
    ]
  },
  "conditions": [
    {
      "logical_operator": false,
      "source_metric_code": "net_sales",
      "tiers": []
    }
  ],
  "bonus_metric_code": "percent_of_net_sales",
  "bonuses": [
    0
  ]
}

Javob

MaydonTurTavsif
_idstringKPI settings ObjectId
organization_idstring
namestring
currency_idstring
user_idsstring[]
periodstringMumkin qiymatlar: week, month, quarter, year
calculation_methodstringMumkin qiymatlar: progressive, threshold
statestringMumkin qiymatlar: draft, active, locked, approved, canceled
date_fromstring (date-time)
date_tostring (date-time)
yearnumber
quarterstring
monthstring
weekstring
filter_enabledboolean
filterobject
filter.is_all_categoriesboolean
filter.customer_category_idsstring[]
filter.customer_nested_category_idsstring[]
filter.customer_idsstring[]
filter.product_category_idsstring[]
filter.product_nested_category_idsstring[]
filter.product_idsstring[]
conditionsobject[]
conditions[].logical_operatorboolean
conditions[].source_metric_codestringMumkin qiymatlar: net_sales, sales_count, avg_net_sales, profit, paid, paid_percent, items_sold
conditions[].tiersobject[]
conditions[].tiers[].min_valuenumber
conditions[].tiers[].max_valuenumber
bonus_metric_codestringMumkin qiymatlar: percent_of_net_sales, percent_of_payment, percent_of_profit, per_sale, fixed_amount, per_item_sold
bonusesnumber[]
created_atstring (date-time)
updated_atstring (date-time)
is_deletedboolean
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "organization_id": "string",
    "name": "string",
    "currency_id": "string",
    "user_ids": [
      "string"
    ],
    "period": "week",
    "calculation_method": "progressive",
    "state": "draft",
    "date_from": "2025-05-01T12:00:00Z",
    "date_to": "2025-05-01T12:00:00Z",
    "year": 0,
    "quarter": "string",
    "month": "string",
    "week": "string",
    "filter_enabled": false,
    "filter": {
      "is_all_categories": false,
      "customer_category_ids": [
        "string"
      ],
      "customer_nested_category_ids": [
        "string"
      ],
      "customer_ids": [
        "string"
      ],
      "product_category_ids": [
        "string"
      ],
      "product_nested_category_ids": [
        "string"
      ],
      "product_ids": [
        "string"
      ]
    },
    "conditions": [
      {
        "logical_operator": false,
        "source_metric_code": "net_sales",
        "tiers": []
      }
    ],
    "bonus_metric_code": "percent_of_net_sales",
    "bonuses": [
      0
    ],
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z",
    "is_deleted": false
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /kpi-settings/get-by-id/{id} ​

Fetch a single KPI settings record by ObjectId.

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaKPI settings ObjectId

So‘rov tanasi

So‘rov tanasi talab qilinmaydi.

Javob

Javob tuzilishi quyidagi bilan bir xil: POST /kpi-settings/create.

POST /kpi-settings/get-paging ​

Paginated list of KPI settings records, optionally filtered by organization or period.

So‘rov tanasi

MaydonTurMajburiyTavsif
pagenumberHaStandart: 1
limitnumberHaStandart: 20
organization_idstringYo‘qFilter by organization ObjectId
periodstringYo‘qFilter by KPI period. Mumkin qiymatlar: week, month, quarter, year
statestringYo‘qFilter by KPI settings state. Mumkin qiymatlar: draft, active, locked, approved, canceled
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "period": "week",
  "state": "draft"
}

Javob

MaydonTurTavsif
totalnumber
listobject[]
list[]._idstringKPI settings ObjectId
list[].organization_idstring
list[].namestring
list[].currency_idstring
list[].user_idsstring[]
list[].periodstringMumkin qiymatlar: week, month, quarter, year
list[].calculation_methodstringMumkin qiymatlar: progressive, threshold
list[].statestringMumkin qiymatlar: draft, active, locked, approved, canceled
list[].date_fromstring (date-time)
list[].date_tostring (date-time)
list[].yearnumber
list[].quarterstring
list[].monthstring
list[].weekstring
list[].filter_enabledboolean
list[].filterobject
list[].filter.is_all_categoriesboolean
list[].filter.customer_category_idsstring[]
list[].filter.customer_nested_category_idsstring[]
list[].filter.customer_idsstring[]
list[].filter.product_category_idsstring[]
list[].filter.product_nested_category_idsstring[]
list[].filter.product_idsstring[]
list[].conditionsobject[]
list[].conditions[].logical_operatorboolean
list[].conditions[].source_metric_codestringMumkin qiymatlar: net_sales, sales_count, avg_net_sales, profit, paid, paid_percent, items_sold
list[].conditions[].tiersobject[]
list[].bonus_metric_codestringMumkin qiymatlar: percent_of_net_sales, percent_of_payment, percent_of_profit, per_sale, fixed_amount, per_item_sold
list[].bonusesnumber[]
list[].created_atstring (date-time)
list[].updated_atstring (date-time)
list[].is_deletedboolean
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "organization_id": "string",
        "name": "string",
        "currency_id": "string",
        "user_ids": [],
        "period": "week",
        "calculation_method": "progressive",
        "state": "draft",
        "date_from": "2025-05-01T12:00:00Z",
        "date_to": "2025-05-01T12:00:00Z",
        "year": 0,
        "quarter": "string",
        "month": "string",
        "week": "string",
        "filter_enabled": false,
        "filter": {
          "is_all_categories": null,
          "customer_category_ids": null,
          "customer_nested_category_ids": null,
          "customer_ids": null,
          "product_category_ids": null,
          "product_nested_category_ids": null,
          "product_ids": null
        },
        "conditions": [],
        "bonus_metric_code": "percent_of_net_sales",
        "bonuses": [],
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z",
        "is_deleted": false
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /kpi-settings/update/{id} ​

Update an existing KPI settings record.

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaKPI settings ObjectId

So‘rov tanasi

MaydonTurMajburiyTavsif
organization_idstringHaOrganization ObjectId this KPI setting belongs to
namestringYo‘qOptional display name for the KPI setting
currency_idstringHaCurrency ObjectId used for monetary KPI metrics
user_idsstring[]HaObjectIds of the employees this KPI setting applies to
periodstringHaKPI evaluation period. Mumkin qiymatlar: week, month, quarter, year
calculation_methodstringHaHow the bonus is calculated across tiers: progressive (each tier adds to the previous) or threshold (only the matched tier applies). Mumkin qiymatlar: progressive, threshold
date_fromstring (date-time)HaStart date of the KPI period
date_tostring (date-time)HaEnd date of the KPI period
yearnumberHaCalendar year of the KPI period
quarterstringYo‘qQuarter label (e.g. Q1) when period is quarter
monthstringYo‘qMonth label when period is month
weekstringYo‘qWeek label when period is week
filter_enabledbooleanYo‘qWhether product/customer filters are active for this KPI setting. Standart: false
filterobjectYo‘qOptional product and customer scope filters
filter.is_all_categoriesbooleanYo‘q
filter.customer_category_idsstring[]Yo‘qCustomer category ObjectIds to include
filter.customer_nested_category_idsstring[]Yo‘q
filter.customer_idsstring[]Yo‘qSpecific customer ObjectIds to include
filter.product_category_idsstring[]Yo‘q
filter.product_nested_category_idsstring[]Yo‘q
filter.product_idsstring[]Yo‘qSpecific product ObjectIds to include
conditionsobject[]HaOne or more KPI plan conditions defining the performance metric and tier thresholds
conditions[].logical_operatorbooleanHatrue = AND with the next condition, false = OR
conditions[].source_metric_codestringHaThe performance metric used to evaluate this condition. Mumkin qiymatlar: net_sales, sales_count, avg_net_sales, profit, paid, paid_percent, items_sold
conditions[].tiersobject[]HaThreshold tiers for this condition
conditions[].tiers[].min_valuenumberHaMinimum metric value for this tier to activate
conditions[].tiers[].max_valuenumberYo‘qMaximum metric value for this tier (omit for the top tier)
bonus_metric_codestringHaHow the bonus amount is computed from the employee's results. Mumkin qiymatlar: percent_of_net_sales, percent_of_payment, percent_of_profit, per_sale, fixed_amount, per_item_sold
bonusesnumber[]HaBonus amounts or percentages, one entry per tier in the conditions
json
{
  "organization_id": "string",
  "name": "string",
  "currency_id": "string",
  "user_ids": [
    "string"
  ],
  "period": "week",
  "calculation_method": "progressive",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "year": 0,
  "quarter": "string",
  "month": "string",
  "week": "string",
  "filter_enabled": false,
  "filter": {
    "is_all_categories": false,
    "customer_category_ids": [
      "string"
    ],
    "customer_nested_category_ids": [
      "string"
    ],
    "customer_ids": [
      "string"
    ],
    "product_category_ids": [
      "string"
    ],
    "product_nested_category_ids": [
      "string"
    ],
    "product_ids": [
      "string"
    ]
  },
  "conditions": [
    {
      "logical_operator": false,
      "source_metric_code": "net_sales",
      "tiers": []
    }
  ],
  "bonus_metric_code": "percent_of_net_sales",
  "bonuses": [
    0
  ]
}

Javob

Javob tuzilishi quyidagi bilan bir xil: POST /kpi-settings/create.

DELETE /kpi-settings/delete/{id} ​

Soft-delete a KPI settings record by ObjectId.

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaKPI settings ObjectId

So‘rov tanasi

So‘rov tanasi talab qilinmaydi.

Javob

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

PUT /kpi-settings/set-status/{id} ​

Change the status (state) of a KPI settings record. Allowed transitions: locked, approved, canceled.

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaKPI settings ObjectId

So‘rov tanasi

MaydonTurMajburiyTavsif
statusstringHaNew status for the KPI settings record. Mumkin qiymatlar: locked, approved, canceled
json
{
  "status": "locked"
}

Javob

Javob tuzilishi quyidagi bilan bir xil: POST /kpi-settings/create.


Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.

Bito 2.0 Integration API