Examples for Landsat 8-9 L1

To request data using any of the request below, you will need to replace the string <your access token> with your Sentinel Hub access token. Sentinel Hub access token will look something like this:

ayJhbGciOiJSUzI1NiJ9.ayJzdWIiOiI0MmYwODZjCy1kMzI3LTRlOTMtYWMxNS00ODAwOGFiZjI0YjIiLCJhdWQiOiJlY2I1MGM1Zi1i
MWM1LTQ3ZTgtYWE4NC0zZTU4NzJlM2I2MTEiLCJqdGkiOiI5MzYxMWE4ODEyNTM4Y2M0MmU0NDJjYjUyMTY0YmJlNyIsImV4cCI6MTU1N
TQyMzk3MiwibmFtZSI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLCJlbWFpbCI6ImFuamEudnJlY2tvQHNpbmVyZ2lzZS5jb20iLC
JzaWQiOiIzZjVjZDVkNS04MjRiLTQ3ZjYtODgwNy0wNDMyNWY4ODQxZmQifQ.U7FPOy_2jlEOFxXSjyN5KEdBROna3-Dyec0feShIbUOY
1p9lEXdNaMmR5euiINi2RXDayX9Kr47CuSTsvq1zHFvZs1YgkFr1iH6kDuX-t_-wfWpqu5oPjoPVKZ4Rj0Ms_dxAUTQFTXR0rlbLuO-KS
gnaeLVb5iiv_qY3Ctq2XKdIRcFRQLFziFcP4yZJl-NZMlwzsiiwjakcpYpI5jSYAdU2hpZLHRzceseeZt5YfZOe5Px1kZXro9Nd0L2GPC
-qzOXw_V1saMGFa2ov8qV6Dvk92iv2SDDdGhOdII_JOf8XkK4E3g2z0EEFdWhG9F4Iky4ukNsqBPgE8LRb31s0hg

and can be obtained as described in the Authentication chapter.

A Postman collection with examples can be downloaded here. Our Postman collections are deprecated and are not being updated since July 2022.

True Color

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3,
sampleType: "AUTO" // default value - scales the output values from [0,1] to [0,255].
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'

True Color Pansharpened

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: [
"B02",
"B03",
"B04",
"B08",
"dataMask"
]
}],
output: {
bands: 4
}
}
}
let minVal = 0.0
let maxVal = 0.4
let viz = new HighlightCompressVisualizer(minVal, maxVal)
function evaluatePixel(samples) {
let sudoPanW = (samples.B04 + samples.B03 + samples.B02 * 0.4) / 2.4
let ratioW = samples.B08 / sudoPanW
let val = [samples.B04 * ratioW, samples.B03 * ratioW, samples.B02 * ratioW]
val = viz.processList(val)
val.push(samples.dataMask)
return val
}
'

True Color, resolution (EPSG 32633)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/32633"
},
"bbox": [
408553.58,
5078145.48,
466081.02,
5126576.61
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"resx": 100,
"resy": 100
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'

True Color, multi-band GeoTIff

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'

True Color, mosaicking with leastRecent

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
},
"mosaickingOrder": "leastRecent"
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
output: {
bands: 3
}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02]
}
'

True color and metadata (multi-part response GeoTIFF and json)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'accept: application/tar' \
-F 'request={
"input": {
"bounds": {
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
},
{
"identifier": "userdata",
"format": {
"type": "application/json"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
mosaicking: Mosaicking.ORBIT,
output: {
id: "default",
bands: 3
}
}
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = {
"scenes": scenes.orbits
}
}
function evaluatePixel(samples) {
return [2.5 * samples[0].B04, 2.5 * samples[0].B03, 2.5 * samples[0].B02]
}
'

True color multi-part response (different formats and SampleType)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'Accept: application/tar' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "true_color",
"format": {
"type": "image/jpeg"
}
},
{
"identifier": "true_color_8bit",
"format": {
"type": "image/png"
}
},
{
"identifier": "true_color_16bit",
"format": {
"type": "image/tiff"
}
},
{
"identifier": "true_color_32float",
"format": {
"type": "image/tiff"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: ["B04", "B03", "B02"],
units: "REFLECTANCE" // default units
}],
output: [{
id: "true_color",
bands: 3,
sampleType: "AUTO" // default - scales the output values from input values [0,1] to [0,255].
},
{
id: "true_color_8bit",
bands: 3,
sampleType: "UINT8"
},
{
id: "true_color_16bit",
bands: 3,
sampleType: "UINT16" //floating point values are automatically rounded to the nearest integer by the service.
},
{
id: "true_color_32float",
bands: 3,
sampleType: "FLOAT32"
}
]
}
}
function evaluatePixel(sample) {
return {
// output band values are scaled from [0,1] to [0,255]. Multiply by 2.5 to increase brightness
true_color: [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02],
// Multiply input reflectance values by 255 to stretch them to [0, 255] unsigned 8 bit range.
true_color_8bit: [sample.B04 * 255, sample.B03 * 255, sample.B02 * 255],
// Multiply input reflectance values by 65535 to stretch them to [0, 65535] unsigned 16 bit range.
true_color_16bit: [sample.B04 * 65535, sample.B03 * 65535, sample.B02 * 65535],
// Reflectance values
true_color_32float: [sample.B04, sample.B03, sample.B02],
}
}
'

NDVI as jpeg image with bounds given as polygon

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/jpeg",
"quality": 80
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands:["B04", "B05"],
}],
output: {
id: "default",
bands: 3,
}
}
}
function evaluatePixel(sample) {
let ndvi = (sample.B05 - sample.B04) / (sample.B05 + sample.B04)
if (ndvi<-0.5) return [0.05,0.05,0.05]
else if (ndvi<-0.2) return [0.75,0.75,0.75]
else if (ndvi<-0.1) return [0.86,0.86,0.86]
else if (ndvi<0) return [0.92,0.92,0.92]
else if (ndvi<0.025) return [1,0.98,0.8]
else if (ndvi<0.05) return [0.93,0.91,0.71]
else if (ndvi<0.075) return [0.87,0.85,0.61]
else if (ndvi<0.1) return [0.8,0.78,0.51]
else if (ndvi<0.125) return [0.74,0.72,0.42]
else if (ndvi<0.15) return [0.69,0.76,0.38]
else if (ndvi<0.175) return [0.64,0.8,0.35]
else if (ndvi<0.2) return [0.57,0.75,0.32]
else if (ndvi<0.25) return [0.5,0.7,0.28]
else if (ndvi<0.3) return [0.44,0.64,0.25]
else if (ndvi<0.35) return [0.38,0.59,0.21]
else if (ndvi<0.4) return [0.31,0.54,0.18]
else if (ndvi<0.45) return [0.25,0.49,0.14]
else if (ndvi<0.5) return [0.19,0.43,0.11]
else if (ndvi<0.55) return [0.13,0.38,0.07]
else if (ndvi<0.6) return [0.06,0.33,0.04]
else return [0,0.27,0]
}'

Exact NDVI values using a floating point GeoTIFF

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return{
input: [{
bands: ["B04", "B05"]
}],
output: {
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
let ndvi = (sample.B05 - sample.B04) / (sample.B05 + sample.B04)
return [ ndvi ]
}'

NDVI image and value (multi-part response png and GeoTIFF)

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-H 'Accept: application/tar' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "ndvi_image",
"format": {
"type": "image/png"
}
},
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: ["B04", "B05"],
}],
output: [{
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
},
{
id: "ndvi_image",
bands: 3,
sampleType: SampleType.AUTO
}
]
}
}
function evaluatePixel(sample) {
let ndvi = (sample.B05 - sample.B04) / (sample.B05 + sample.B04)
if (ndvi < -0.5) image = [0.05, 0.05, 0.05]
else if (ndvi < -0.2) image = [0.75, 0.75, 0.75]
else if (ndvi < -0.1) image = [0.86, 0.86, 0.86]
else if (ndvi < 0) image = [0.92, 0.92, 0.92]
else if (ndvi < 0.025) image = [1, 0.98, 0.8]
else if (ndvi < 0.05) image = [0.93, 0.91, 0.71]
else if (ndvi < 0.075) image = [0.87, 0.85, 0.61]
else if (ndvi < 0.1) image = [0.8, 0.78, 0.51]
else if (ndvi < 0.125) image = [0.74, 0.72, 0.42]
else if (ndvi < 0.15) image = [0.69, 0.76, 0.38]
else if (ndvi < 0.175) image = [0.64, 0.8, 0.35]
else if (ndvi < 0.2) image = [0.57, 0.75, 0.32]
else if (ndvi < 0.25) image = [0.5, 0.7, 0.28]
else if (ndvi < 0.3) image = [0.44, 0.64, 0.25]
else if (ndvi < 0.35) image = [0.38, 0.59, 0.21]
else if (ndvi < 0.4) image = [0.31, 0.54, 0.18]
else if (ndvi < 0.45) image = [0.25, 0.49, 0.14]
else if (ndvi < 0.5) image = [0.19, 0.43, 0.11]
else if (ndvi < 0.55) image = [0.13, 0.38, 0.07]
else if (ndvi < 0.6) image = [0.06, 0.33, 0.04]
else image = [0, 0.27, 0]
return {
default: [ndvi],
ndvi_image: image
}
}
'

All Landsat 8-9 L1 bands as GeoTIFF

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.480661,
41.965872
],
[
12.523909,
41.96817
],
[
12.553084,
41.931401
],
[
12.525968,
41.906365
],
[
12.491645,
41.894355
],
[
12.449084,
41.896911
],
[
12.433295,
41.926292
],
[
12.442219,
41.950043
],
[
12.480661,
41.965872
]
]
]
}
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B09", "B10", "B11", "BQA"]
}],
output: {
id: "default",
bands: 12,
sampleType: SampleType.UINT16 //floating point values are automatically rounded to the nearest integer by the service.
}
}
}
function evaluatePixel(sample) {
// For optical bands B01-B09, return reflectance multiplied by 10000 as integers to save processing units. To obtain reflectance values, simply divide the resulting pixel values by 10000.
return [10000 * sample.B01, 10000 * sample.B02, 10000 * sample.B03, 10000 * sample.B04, 10000 * sample.B05, 10000 * sample.B06, 10000 * sample.B07, 10000 * sample.B08, 10000 * sample.B09, sample.B10, sample.B11, sample.BQA]
}
'

Thermal Band as jpeg image with bounds given as bounding box

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/png"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
let minVal = 200
let maxVal = 375
let viz = ColorGradientVisualizer.createBlueRed(minVal, maxVal)
function setup() {
return {
input: [{
bands: [
"B10",
"dataMask"
]
}],
output: {
bands: 4
}
}
}
function evaluatePixel(samples) {
let val = samples.B10
val = viz.process(val)
val.push(samples.dataMask)
return val
}
'

Extract Thermal band Kelvin values using a FLOAT32 GeoTIFF

curl -X POST \
https://services-uswest2.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your access token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"bbox": [
12.401213,
41.855754,
12.609214,
41.996243
]
},
"data": [{
"type": "landsat-ot-l1",
"dataFilter": {
"timeRange": {
"from": "2020-07-01T00:00:00Z",
"to": "2020-07-31T00:00:00Z"
}
}
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}]
}
}
' \
-F 'evalscript=//VERSION=3
function setup() {
return {
input: [{
bands: [
"B10"
]
}],
output: {
bands: 1,
sampleType: "FLOAT32"
}
}
}
function evaluatePixel(samples) {
return [samples.B10]
}
'