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

# Ejecutar Comando en el Servidor

> Sends a command for execution on ER:LC server.


Commands are added to global queue with maximum command limit.


**Note:** This endpoint is **not subject** to Rate Limiting (120 requests/min).




## OpenAPI

````yaml en/openapi/en-erlc-v2-openapi.yaml POST /erlc/server/command
openapi: 3.1.0
info:
  title: Moscow RolePlay API - ERLC v2 Endpoints
  description: >
    Endpoints for ERLC v2 API server management.


    ## What's new in v2 API?


    PRC API v2 provides a more consistent and simpler request model for
    developers.

    Also includes requested data such as player locations and vehicle colors!


    API v1 continues to work without significant changes.


    ## Rate Limits


    | Endpoint | Limit |

    |----------|-------|

    | `/erlc/server/*` (except command) | 120 requests/min |

    | `/erlc/server/command` | Queue: 100 commands |


    Returns **HTTP 429** when limit is exceeded.


    ## Error Response Format


    All errors are returned in JSON format with `code` and `message` fields:


    ```json

    {
        "code": 5007,
        "message": "missing_token"
    }

    ```


    ## Error Codes


    ### Authentication and Access Errors


    | Code | Status | Description |

    |-----|--------|----------|

    | 5006 | 401 | invalid_master_key |

    | 5007 | 401 | missing_token |

    | 5008 | 401 | invalid_token |

    | 5009 | 403 | forbidden |

    | 5010 | 403 | api_version_forbidden |

    | 5011 | 403 | query_param_forbidden |


    ### PRC API Errors


    Endpoints use external PRC API and may return errors:


    | PRC Code | Description |

    |---------|----------|

    | 2002 | Invalid or expired server-key |

    | 3002 | Server is offline |

    | 4001 | Rate limited |

    | 9999 | Module out of date |


    When PRC API error occurs, returns:


    ```json

    {
        "code": 5019,
        "message": "prc_api_error",
        "prc_code": 2002,
        "prc_message": "Invalid or expired server-key"
    }

    ```


    Base URL: `https://api.erlcrussia.xyz/v2`
  version: 2.0.0
servers:
  - url: https://api.erlcrussia.xyz/v2
    description: Production
security: []
tags:
  - name: ERLC v2
    description: ER:LC v2 API game server data and management.
paths:
  /erlc/server/command:
    post:
      tags:
        - ERLC v2
      summary: Execute Command on Server
      description: >
        Sends a command for execution on ER:LC server.



        Commands are added to global queue with maximum command limit.



        **Note:** This endpoint is **not subject** to Rate Limiting (120
        requests/min).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - command
              properties:
                command:
                  type: string
                  description: Command to execute on server.
                  example: ':h Hello Everyone'
      responses:
        '200':
          description: Command successfully added to queue.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    description: Command status.
                    example: Queued
                  QueueSize:
                    type: integer
                    description: Current command queue size.
                    example: 5
              examples:
                success:
                  summary: Command added to queue.
                  value:
                    Status: Queued
                    QueueSize: 5
        '400':
          description: Request error (command missing).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MissingCommandError'
              examples:
                missing_command:
                  summary: Command field missing.
                  value:
                    code: 5005
                    message: MissingCommand
        '401':
          $ref: '#/components/responses/UnauthorizedMissingOrInvalidToken'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          description: Command queue is full.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandQueueFullError'
              examples:
                queue_full:
                  summary: Command queue is full.
                  value:
                    code: 5015
                    message: CommandQueueFull
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - MRPAPIKey: []
components:
  schemas:
    MissingCommandError:
      type: object
      description: Error when command is missing in request.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5005
        message:
          type: string
          example: MissingCommand
    CommandQueueFullError:
      type: object
      description: >-
        Error when command queue is full. Returned when trying to send command
        with full queue.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5015
        message:
          type: string
          example: CommandQueueFull
    UnauthorizedError:
      type: object
      description: Authentication error (missing or invalid token).
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5007
        message:
          type: string
          example: missing_token
    ForbiddenError:
      type: object
      description: Access error (forbidden).
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 5009
        message:
          type: string
          example: forbidden
    ErrorResponse:
      type: object
      description: Standard error format.
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: API error code.
          example: 5007
        message:
          type: string
          description: Error message/identifier.
          example: missing_token
  responses:
    UnauthorizedMissingOrInvalidToken:
      description: Authentication error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedError'
          examples:
            missing_token:
              summary: No token.
              value:
                code: 5007
                message: missing_token
            invalid_token:
              summary: Invalid or deactivated token.
              value:
                code: 5008
                message: invalid_token
            invalid_master_key:
              summary: Invalid master key.
              value:
                code: 5006
                message: invalid_master_key
    Forbidden:
      description: Access forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenError'
          examples:
            forbidden:
              summary: No access rights to endpoint.
              value:
                code: 5009
                message: forbidden
            api_version_forbidden:
              summary: Access to this API version is forbidden.
              value:
                code: 5010
                message: api_version_forbidden
            query_param_forbidden:
              summary: Query parameter is forbidden.
              value:
                code: 5011
                message: query_param_forbidden
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            server_error:
              summary: External ER:LC API error.
              value:
                code: 5018
                message: server_error
  securitySchemes:
    MRPAPIKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Standard API key for accessing ER:LC endpoints.

        Passed in `Authorization: Bearer <key>` header.

        REQUIRED FOR ALL ER:LC ENDPOINTS.

````