> ## 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.

# Операции с Экономикой

> Выполнение операций с системой экономики (транзакции, переводы и т.д.).

Доступные действия:
- `transfer` - перевод между пользователями (требует fromUserId, toUserId, amount).
- `deposit` - положить деньги в банк (требует userId, amount).
- `withdraw` - снять деньги из банка (требует userId, amount).
- `add` - добавить деньги пользователю (требует userId, amount, type).
- `remove` - забрать деньги у пользователя (требует userId, amount, type).
- `reset` - сбросить баланс пользователя (требует userId).
- `resetCooldown` - сбросить кулдауны пользователя (требует userId, command).

Параметр type для add/remove может быть 'cash' или 'bank' (по умолчанию 'cash').




## OpenAPI

````yaml ru/openapi/ru-economy-v2-openapi.yaml POST /moscowroleplay/civops/economy
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: ER:LC Россия API V2
security: []
tags:
  - name: Moscow RolePlay API Экономики V2
    description: Эндпоинты для управления экономикой и CivOps системой.
paths:
  /moscowroleplay/civops/economy:
    post:
      tags:
        - Moscow RolePlay API Экономики V2
      summary: Операции с Экономикой
      description: >
        Выполнение операций с системой экономики (транзакции, переводы и т.д.).


        Доступные действия:

        - `transfer` - перевод между пользователями (требует fromUserId,
        toUserId, amount).

        - `deposit` - положить деньги в банк (требует userId, amount).

        - `withdraw` - снять деньги из банка (требует userId, amount).

        - `add` - добавить деньги пользователю (требует userId, amount, type).

        - `remove` - забрать деньги у пользователя (требует userId, amount,
        type).

        - `reset` - сбросить баланс пользователя (требует userId).

        - `resetCooldown` - сбросить кулдауны пользователя (требует userId,
        command).


        Параметр type для add/remove может быть 'cash' или 'bank' (по умолчанию
        'cash').
      parameters:
        - name: action
          in: query
          description: Тип операции.
          required: true
          schema:
            type: string
            enum:
              - transfer
              - deposit
              - withdraw
              - add
              - remove
              - reset
              - resetCooldown
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
            examples:
              transfer:
                summary: Перевод между пользователями.
                value:
                  fromUserId: '1027118272879009886'
                  toUserId: '1133665013794607114'
                  amount: 100000
              deposit:
                summary: Положить деньги в банк.
                value:
                  userId: '1133665013794607114'
                  amount: 50000
              withdraw:
                summary: Вывести деньги из банка.
                value:
                  userId: '1133665013794607114'
                  amount: 20000
              add:
                summary: Добавить деньги.
                value:
                  userId: '1133665013794607114'
                  amount: 5000
                  type: cash
              remove:
                summary: Забрать деньги.
                value:
                  userId: '1133665013794607114'
                  amount: 2000
                  type: bank
              reset:
                summary: Сбросить баланс.
                value:
                  userId: '1133665013794607114'
              resetCooldown:
                summary: Сбросить кулдаун на команду.
                value:
                  userId: '1133665013794607114'
                  command: работать
      responses:
        '200':
          description: Операция успешно выполнена.
          content:
            application/json:
              schema:
                type: object
              examples:
                transfer:
                  summary: Успешный перевод.
                  value:
                    success: true
                    fromUserId: '1027118272879009886'
                    toUserId: '1133665013794607114'
                    amount: 100000
                    newBalance:
                      cash: 104000
                      bank: 10000
                deposit:
                  summary: Успешный депозит.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    deposited: 50000
                    newBank: 150000
                    newCash: 3000
                withdraw:
                  summary: Успешное снятие.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    withdrawn: 50000
                    newBank: 53000
                    newCash: 100000
                add:
                  summary: Деньги добавлены.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    type: cash
                    amount: 5000
                    newBalance:
                      cash: 10000
                      bank: 10000
                remove:
                  summary: Деньги удалены.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    type: bank
                    amount: 2000
                    newBalance:
                      cash: 5000
                      bank: 8000
                reset:
                  summary: Баланс сброшен.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    newBalance:
                      cash: 0
                      bank: 0
                resetCooldown:
                  summary: Кулдаун сброшен.
                  value:
                    success: true
                    userId: '1133665013794607114'
                    command: работать
        '400':
          description: >-
            Ошибка запроса (отсутствуют обязательные поля или неизвестный
            action).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedMissingOrInvalidToken'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - MRPAPIKey: []
components:
  schemas:
    ErrorResponse:
      type: object
      description: Стандартный формат ошибки.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: Код ошибки API.
          example: 5007
        message:
          type: string
          description: Сообщение/идентификатор ошибки.
          example: Missing Token
    UnauthorizedError:
      type: object
      description: Ошибка аутентификации (отсутствует или неверный токен).
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5007
        message:
          type: string
          example: Missing Token
    ForbiddenError:
      type: object
      description: Ошибка доступа (запрещено).
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5009
        message:
          type: string
          example: Forbidden
    RateLimitError:
      type: object
      description: Ошибка превышения лимита запросов.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 6021
        message:
          type: string
          example: Rate Limit Exceeded
        retry_after:
          type: integer
          description: Время до сброса лимита в секундах.
          example: 30
    EconomyApiError:
      type: object
      description: Ошибка API Экономики.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 6010
        message:
          type: string
          example: Business not found
  responses:
    UnauthorizedMissingOrInvalidToken:
      description: Ошибка аутентификации.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedError'
          examples:
            Missing Token:
              summary: Нет токена.
              value:
                code: 5007
                message: Missing Token
            Invalid Token:
              summary: Неверный или деактивированный токен.
              value:
                code: 5008
                message: Invalid Token
            Invalid Master Key:
              summary: Неверный мастер-ключ.
              value:
                code: 5006
                message: Invalid Master Key
    Forbidden:
      description: Доступ запрещён.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenError'
          examples:
            Forbidden:
              summary: Нет прав доступа к эндпоинту.
              value:
                code: 5009
                message: Forbidden
            Api Version Forbidden:
              summary: Доступ к этой версии API запрещён.
              value:
                code: 5010
                message: Api Version Forbidden
            Query Param Forbidden:
              summary: Query-параметр запрещён.
              value:
                code: 5011
                message: Query Param Forbidden
    TooManyRequests:
      description: Превышено количество запросов.
      headers:
        X-RateLimit-Limit:
          description: Максимум запросов в минуту.
          schema:
            type: integer
            example: 60
        X-RateLimit-Remaining:
          description: Оставшееся количество запросов.
          schema:
            type: integer
            example: 0
        Retry-After:
          description: Секунд до сброса лимита.
          schema:
            type: integer
            example: 30
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          examples:
            Rate Limit Exceeded:
              summary: Превышение лимита запросов.
              value:
                code: 6021
                message: Rate Limit Exceeded
                retry_after: 30
    InternalServerError:
      description: Внутренняя ошибка сервера.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EconomyApiError'
          examples:
            Internal Server Error Occurred:
              summary: Ошибка API экономики.
              value:
                code: 6005
                message: Internal Server Error Occurred.
  securitySchemes:
    MRPAPIKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        API ключ для доступа к эндпоинтам Гражданских Операций.

        Передается в заголовке `Authorization: Bearer <ключ>`.

        ОБЯЗАТЕЛЕН ДЛЯ ВСЕХ ЭНДПОИНТОВ ГРАЖДАНСКИХ ОПЕРАЦИЙ (кроме /health).

````