Admin API: Environment variables


This endpoint allows you to manage the environment variables, without restarting the mock server or the application.

 Set or update an environment variable

To set or update an environment variable, call the /mockoon-admin/env-vars endpoint with the following parameters:

  • Method: POST, PUT or PATCH
  • URL: /mockoon-admin/env-vars
  • Body: JSON object with the following properties:
    • key: the name of the variable, including the MOCKOON_ prefix, or the custom prefix defined in the application settings.
    • value: the value of the variable.

Example:

Copy
POST /mockoon-admin/env-vars Content-Type: application/json { "key": "MOCKOON_ENV_VAR", "value": "myValue" }