How to get ndvi statistics from sentinel-2-l1c

would you please tell me what is wrong in the below posted request?
for the specified geometry, i want to have some statistics about the ndvi from sentinel-2-l1c

request

curl -X POST https://services.sentinel-hub.com/api/v1/statistics \
 -H 'Authorization: Bearer 
 -H 'Accept: application/json' \
 -H 'Content-Type: application/json' \
 -d '{
  "input": {
	"bounds": {
	  "geometry": {
		"type": "Polygon",
		"coordinates": [
		  [
			[
			  1524956.5069012325,
			  6429656.961521158
			],
			[
			  1539801.8465620074,
			  6373574.5169089185
			],
			[
			  1648667.6707410228,
			  6431306.443705688
			],
			[
			  1562069.8560531696,
			  6451924.97101232
			],
			[
			  1524956.5069012325,
			  6429656.961521158
			]
		  ]
		]
	  },
	  "properties": {
		"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
	  }
	},
	"data": [
	  {
		"dataFilter": {},
		"type": "sentinel-2-l1c"
	  }
	]
  },
  "aggregation": {
	"timeRange": {
	  "from": "2024-03-01T00:00:00Z",
	  "to": "2024-03-08T23:59:59Z"
	},
	"aggregationInterval": {
	  "of": "P1D"
	},
	"resx": "100",
	"resy": "100",
	"evalscript": "//VERSION=3\nfunction setup() {\n        return {\n          input: [{\n            bands: [\n              \"B04\", \"B08\", \"dataMask\"\n            ]\n          }],\n          output: [\n            {\n              id: \"ndvi\", bands: 1\n            },\n            {\n              id: \"dataMask\", bands: 1\n            }\n          ]\n        };\n      }\n      \n      function evaluatePixel(samples) {\n          let index = (samples.B08 - samples.B04) / (samples.B08 + samples.B04);\n          return {\n              ndvi: [index],\n              dataMask: [samples.dataMask]\n          };\n      }\n"
  },
  "calculations": {
	"default": {}
  }
}'

Hi Burkhard,

The request you have shared with me works for me. What was the error that you recieved?

for the following request in nodejs:

const req = {
        "input": {
            "bounds": {
              "geometry": coordsInEPSG3857,
              "properties": {
                "crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
              }
            },
            "data": [
              {
                "dataFilter": {
                  "timeRange": {
                    "from": sYear + "-" + sMonth + "-" + sDay + "T" + "00:00:00Z",
                    "to": eYear + "-" + eMonth + "-" + eDay + "T" + "00:00:00Z"
                  }
                },
                "type": satMissionType
              }
            ]
          },
          "aggregation": {
            "timeRange": {
                "from": sYear + "-" + sMonth + "-" + sDay + "T" + "00:00:00Z",
                "to": eYear + "-" + eMonth + "-" + eDay + "T" + "00:00:00Z"
              },
            "aggregationInterval": {
                "of": "P1D"
            },
            "resx": lowestResolution,
            "resy": lowestResolution,
            "evalscript": evalscript,
          },
        };

when i replace the parameters in the above request with the values posted in my original question, i receive result code: 400

Apologies for the slow response. There is no authentication in the request that you have shared here. Therefore, you receive a 400 error. You can check out the authentication docs here.