Posting Evalscripts files to the API endpoint

Hi everyone,

I have had a skim through the existing examples of using the Sentinel Hub API and have used them successfully in a python script. I was wondering whether there is an existing way to replace the hard-coded EvalScript in the JSON payload with posting instead an EvalScript file including the JavaScript code. Is that possible?
For example:

with open(“example_evalscript.js”, “r”) as f:, headers=headers, json=json, files={example_evalscript.js: f})

When I try the above I am getting a 500 HTTP response status code which means that very likely this functionality doesn’t exist, but if not is there a work-around?

Kind regards,

Using sentinelhub-py implementation (to be released in next few days, until then feat/stat-api branch you can do precisely that:

with open('./data/statapi_evalscript.js', 'r') as es:
    evalscript =


stats = SentinelHubStat(aggregation=aggregation, calculations=calculations, input_data=[input_data], bbox=bbox)

response = stats.get_data()[0]

There will be a notebook with the proper release, showcasing the functionality.

1 Like

Thanks @batic! Good to know that this will be released soon! It will help a lot with managing processing scripts!

Will ping you when it’s ready.

1 Like