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

# Унифицированная Статистика

> **Ограничения:**
- DOT: только `membercount`
- MRP: `playercount` доступен только для MRP




## OpenAPI

````yaml ru/openapi/ru-stats-v2-openapi.yaml GET /moscowroleplay/stats
openapi: 3.1.0
info:
  title: ER:LC Россия API V2 - Moscow RolePlay API Статистики V2
  version: 2.0.0
servers:
  - url: https://api.erlcrussia.xyz/v2
    description: Moscow RolePlay API Статистики V2
security: []
tags:
  - name: Moscow RolePlay API Статистики V2
    description: Унифицированная статистика Moscow RolePlay.
paths:
  /moscowroleplay/stats:
    get:
      tags:
        - Moscow RolePlay API Статистики V2
      summary: Унифицированная Статистика
      description: |
        **Ограничения:**
        - DOT: только `membercount`
        - MRP: `playercount` доступен только для MRP
      parameters:
        - name: servers
          in: query
          required: true
          description: >
            Имена серверов. Можно указать несколько через повторяющийся
            параметр.
          schema:
            type: array
            items:
              type: string
              enum:
                - MVD
                - FSB
                - MCHS
                - MZ
                - '112'
                - DOT
                - MRP
          example: MVD
        - name: metrics
          in: query
          required: true
          description: |
            Типы метрик. Должно соответствовать количеству `servers`.
          schema:
            type: array
            items:
              type: string
              enum:
                - membercount
                - allmembercount
                - botcount
                - playercount
          example: membercount
        - name: Authorization
          in: header
          required: false
          description: >
            Опциональный API ключ для увеличения лимита с 40 до 120
            запросов/мин.


            Передается в заголовке `Authorization: Bearer <ключ>`.
          schema:
            type: string
          example: Bearer your-api-key-here
      responses:
        '200':
          description: |
            Успешный ответ. Формат зависит от количества запросов:
            - 1 запрос → text/plain
            - Несколько → application/json
          content:
            text/plain:
              schema:
                type: string
                description: Значение метрики (только для 1 запроса)
                example: '67'
            application/json:
              schema:
                type: object
                description: Объект с результатами (только для нескольких запросов)
                additionalProperties:
                  type: object
                  additionalProperties:
                    type: string
              example:
                MVD:
                  membercount: '67'
                FSB:
                  botcount: '5'
        '400':
          description: |
            Неверный запрос. Возможные причины:
            - Отсутствуют обязательные параметры
            - Неподдерживаемый сервер или метрика
            - Несовпадение количества servers и metrics
            - Playercount для сервера отличного от MRP
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Missing Parameters:
                  summary: Отсутствуют обязательные параметры
                  value:
                    code: 5001
                    message: 'Missing required query parameters: servers and metrics'
                Mismatch:
                  summary: Несовпадение массивов
                  value:
                    code: 5002
                    message: Servers and metrics arrays must have same length
                Unsupported Server:
                  summary: Неподдерживаемый сервер
                  value:
                    code: 5003
                    message: Unsupported Server
                Unsupported Metric:
                  summary: Неподдерживаемая метрика
                  value:
                    code: 5004
                    message: Unsupported Metric
                Playercount Not MRP:
                  summary: Playercount только для MRP
                  value:
                    code: 5005
                    message: Playercount is only available for MRP server
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ErrorResponse:
      type: object
      description: Стандартный формат ошибки.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: Код ошибки API.
          example: 5001
        message:
          type: string
          description: Сообщение/идентификатор ошибки.
          example: Missing Discord Id
        retry_after:
          type: integer
          description: Секунд до сброса лимита (только для 429).
          example: 45
        details:
          type: object
          description: Дополнительные детали ошибки.
        blocked_until:
          type: integer
          description: Unix timestamp (мс) окончания бана.
          example: 1740339900000
        remaining_seconds:
          type: integer
          description: Оставшихся секунд блокировки.
          example: 300
  responses:
    Unauthorized:
      description: Ошибка аутентификации (неверный токен).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Invalid Token:
              summary: Неверный или деактивированный токен.
              value:
                code: 5008
                message: Invalid Token
    TooManyRequests:
      description: |
        Превышен лимит запросов:
        - Без токена: 40 запросов/мин
        - С токеном: 120 запросов/мин
      headers:
        X-RateLimit-Limit:
          description: Максимум запросов в минуту.
          schema:
            type: integer
            example: 40
        X-RateLimit-Remaining:
          description: Оставшееся количество запросов.
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Unix timestamp (мс), когда лимит будет сброшен.
          schema:
            type: integer
            example: 1740339600000
        Retry-After:
          description: Секунд до сброса лимита.
          schema:
            type: integer
            example: 45
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Rate Limit Exceeded:
              summary: Превышение лимита
              value:
                code: 5016
                message: Rate Limit Exceeded
                retry_after: 45
                details:
                  limit: 40
                  count: 45
                  excess: 5
                  reset_at: 1740339600000
    InternalServerError:
      description: Внутренняя ошибка сервера.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Server Error:
              summary: Ошибка внешнего API
              value:
                code: 5018
                message: Server Error

````