REST API
Submit S2DR3 jobs with the new image selection (date range and cloud limit), credits and clearer errors, then check job state and credits.
Latest release: v1.1
The API lets you submit asynchronous S2DR3 processing jobs. A job submission returns metadata immediately. The generated products appear in the corresponding storage location after processing.
Changelog
- The image is chosen from a period around your date, not only on the exact
date.
dateis the target date. With Version 1.0 the request failed if no scene existed on that exact date. - A cloud limit now means a limit.
max_cloudsremoves every image with more cloud cover over your AOI than the limit. When you set no limit, the clearest image in the period is used. - Default search period:
date_rangedefaults to 7 days (maximum 90), and images up to 3 days afterdateare included. - Unusable images are skipped automatically instead of failing the job.
- Credits are part of the workflow: credits are reserved when you submit a
job and charged when it completes. Repeating the same area and image date with
the same API key is free. The response shows
requested_creditsandremaining_total_balance. - Your balance and latest jobs are available from
GET /jobs/{API_KEY}, and the job state includes the credit status of the job. - Clear error messages with status codes 400, 401, 402, 404 and 503.
- Areas that are too large are refused (status 400) before any credits are reserved; keep the area to about 150 km2 (12 x 12 km).
- Results that cannot be saved are reported. If the output files of a job cannot be stored, the job now ends as failed (and its credits are returned) instead of ending as completed with files missing.
- Dates must be written
YYYY-MM-DD(a month or day without its leading zero is accepted). - A valid API key is required to submit a job.
The following were introduced in earlier releases and are still current:
- 1.0: the API runs on AWS and accommodates a large number of parallel jobs.
- 0.2: parameters
date_rangeandmax_clouds.
If you are moving from Version 1.0, read the changelog above first.
Before You Start
For instructions on how to generate your API key, see API Access & Keys. A valid API key is required to submit a job.
Call the API at:
https://api.gamma.earth/jobs/{API_KEY}
Replace {API_KEY} with your API key. Every example below uses this endpoint.
If your integration still posts to the endpoint used before the move to AWS, see the migration notes in Version 1.0.
Submit a Job
Endpoint:
https://api.gamma.earth/jobs/{API_KEY}
Method:
POST
Example payload:
{
"date": "2024-01-31",
"date_range": 30,
"max_clouds": 10,
"aoi": "-74.165 4.690 -74.125 4.715"
}
Request Parameters
| Parameter | Required | Description |
|---|---|---|
date | Yes | Target date, written YYYY-MM-DD. Gamma Earth chooses the Sentinel-2 image around this date, as described in How the Image Is Chosen below. |
aoi | Yes | Bounding box for the area of interest in minx miny maxx maxy order (longitude and latitude). The area should not exceed 150 km2 (about 12 x 12 km) and should fit within a single Sentinel-2 scene. |
date_range | No | Number of days before date to search. Whole number from 0 to 90. Default: 7. Images up to 3 days after date are also considered. |
max_clouds | No | Maximum cloud cover over your AOI, in percent (0 to 100). Default: 100 (no limit). |
How the Image Is Chosen
Gamma Earth looks at the Sentinel-2 images acquired from date - date_range
days up to 3 days after date. Cloud cover is measured over your AOI, not over
the whole Sentinel-2 tile. Then:
| Your request | Image used |
|---|---|
No max_clouds (or max_clouds set to 100) | The clearest image in the period. If several are equally clear, the one closest to date; if two are equally close, the later one. |
max_clouds below 100 | Images with more cloud cover than your limit are dropped. Among the rest, the image closest to date. |
Images whose data is not available for processing are skipped automatically, and the next best image is used.
If no image qualifies, the request is refused with an explanation and nothing is charged. See Errors below.
The response tells you which image was used: date is its acquisition date and
cloud_cover is its cloud cover over your AOI, in percent.
Credits
Each job uses credits from the balance of your API key. The amount depends on the area of your AOI and its region; see How Credits Work.
- When you submit a job, the credits are reserved. They are charged when the job completes, and returned if the job fails.
- If your balance is not enough, the job is refused and nothing is reserved.
- Processing the same area on the same image date again with the same API key
is free. The response then contains
credits_charged: 0and a short note. The first job must have completed for the repeat to be free; a repeat submitted while the first job is still running is reserved as usual and returned when it completes.
Example Response
The API returns job metadata, not the processed data itself.
{
"uid": "xxxx",
"job_id": "a3781528-90c4-11f1",
"date": "20240118",
"MGRS": "18NWL",
"ISO": "CO",
"aoi": "-74.165 4.690 -74.125 4.715",
"sdk": false,
"save_path_S3_TCI": "s3://s2dr3-output/CO/T18NWL/T18NWL-200b906d1-20240118/S2L2Ax10_T18NWL-200b906d1-20240118_TCI.tif",
"cloud_cover": 1,
"sid": "200b906d1",
"pid": "T18NWL-200b906d1-20240118",
"no_bands": "10",
"make_preview": "true",
"requested_credits": 8,
"remaining_total_balance": 992
}
Important response fields:
| Field | Description |
|---|---|
job_id | Identifier used to check processing state. |
date | Acquisition date of the image that was chosen, YYYYMMDD. |
cloud_cover | Cloud cover of that image over your AOI, in percent. |
save_path_S3_TCI | S3 path for the super-resolved true-color dataset. Download your results from here. |
pid | Product identifier for the generated scene: the area and the image date. |
requested_credits | Credits reserved for this job. |
remaining_total_balance | Your balance after the reservation. |
credits_charged, credits_note | Present instead of requested_credits when the job is a free repeat. |
Errors
When a request cannot be accepted, the API answers with an HTTP status code and
a JSON body with an error field. Nothing is reserved or charged.
| Status | Meaning | Example message |
|---|---|---|
| 400 | A value is invalid: date, date_range, max_clouds, an identifier, or the area is too large. | max_clouds must be a number between 0 and 100. / The area of interest is too large for one job (about 210 km2). Use an area of about 150 km2 or less (for example 12 x 12 km), or split it into several requests. |
| 401 | The API key is missing, not valid, inactive or expired. | Invalid API key. / This API key is inactive or has expired. Add credits or create a new key in your Gamma Earth account (https://app.gamma.earth/plans). |
| 402 | Your balance is not enough for the job. | Not enough credits: this job needs 25 credits and you have 10. Add credits in your Gamma Earth account (https://app.gamma.earth/plans). |
| 404 | No image meets your date range and cloud limit, or the job does not exist. | No image found between 2024-01-01 and 2024-02-03 ... The clearest image in this period has 12% cloud cover; try a larger date_range or a higher max_clouds. |
| 503 | The credits could not be reserved for a temporary reason. | Unable to reserve credits for this job. Please try again. |
Check Job State
Append the job_id from the submission response to your endpoint:
https://api.gamma.earth/jobs/{API_KEY}/{job_id}
Method:
GET
Example response:
{
"job_id": "a3781528-90c4-11f1",
"state": "completed",
"credits_status": "COMMITTED",
"credits_requested": 8,
"credits_used": 8,
"reserved_at": "2026-10-14T09:12:05",
"pid": "T18NWL-200b906d1-20240118"
}
credits_status is PENDING while the job runs (credits reserved, not yet
charged), COMMITTED when they were charged and RELEASED when they were
returned to your balance. A free repeat has no credit fields.
Check Your Credits
To see your balance and your latest jobs, send a GET request to your endpoint
without a job_id:
https://api.gamma.earth/jobs/{API_KEY}?limit=20
limit is optional (default 50, maximum 200). Example response:
{
"credits": {
"purchased_balance": 917,
"bonus_balance": 75,
"total_balance": 992
},
"jobs": [
{
"job_id": "a3781528-90c4-11f1",
"pid": "T18NWL-200b906d1-20240118",
"credits_status": "COMMITTED",
"credits_requested": 8,
"credits_used": 8,
"reserved_at": "2026-10-14T09:12:05",
"release_reason": null
}
]
}
For what the balance includes, see Credit Balance and History.
Download Outputs
Download your results from save_path_S3_TCI. The response returns the S3
path for the true-color product, but the same S3 directory holds every
product generated for the job. Swap the filename to fetch the others, using
the job's pid:
| Filename | Product | Resolution |
|---|---|---|
S2L2A_<pid>_TCI.tif | True color | Sentinel-2 source |
S2L2A_<pid>_MS.tif | Multispectral | Sentinel-2 source |
S2L2A_<pid>_NDVI.tif | NDVI | Sentinel-2 source |
S2L2A_<pid>_IRP.tif | Infrared pseudo-color | Sentinel-2 source |
S2L2Ax10_<pid>_TCI.tif | True color | Super-resolved (x10) |
S2L2Ax10_<pid>_MS.tif | Multispectral | Super-resolved (x10) |
S2L2Ax10_<pid>_NDVI.tif | NDVI | Super-resolved (x10) |
S2L2Ax10_<pid>_IRP.tif | Infrared pseudo-color | Super-resolved (x10) |
Old Versions
Articles for earlier releases of the API, kept for reference: