input: Write a function to create an API using Flask and Python which takes a list or array of integers and returns their minimum and maximum values. If the input list is empty, the function should return an error message indicating that the input is invalid.
  
  
  from flask import Flask, request, jsonify
  app = Flask(__name__)
  
  @app.route('/minmax', methods=['POST'])
  def minmax():
      data = request.get_json()
      nums = data.get('nums', [])
      if not nums:
          return jsonify({"error": "Invalid input: empty list"}), 400
      minVal = min(nums)
      maxVal = max(nums)
      return jsonify({'min': minVal, 'max': maxVal})
  
  if __name__ == '__main__':
      app.run()
  
  
  assert minmax({"nums": [12, 4, 9, 24, -5]}) == {'min': -5, 'max': 24}
  assert minmax({"nums": [0, 0, 0, 0]}) == {'min': 0, 'max': 0}
  assert minmax({"nums": []}) == {"error": "Invalid input: empty list"}, 400
output: 
  def minmax():
      data = request.get_json()
      nums = data.get('nums', [])
      if not nums:
          return jsonify({"error": "Invalid input: empty list"}), 400
      minVal = min(nums)
      maxVal = max(nums)
      return jsonify({'min': minVal, 'max': maxVal})
  