Skip to content

Command line tools

Preparation

Install the command line tools:

python3 -m pip install 'stac-asset[cli]'

If you don't have system wide privileges, you can always use virtualenv.

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install 'stac-asset[cli]'

Request an Access Token

Replace <API_CREDENTIAL_ID> and <API_CREDENTIAL_SECRET> with your credentials.

ACCESS_TOKEN=$(curl --location --request POST 'https://login.satellogic.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'audience=https://api.satellogic.com/' \
--data-urlencode 'client_id=<API_CREDENTIAL_ID>' \
--data-urlencode 'client_secret=<API_CREDENTIAL_SECRET>' -s | jq -r '.access_token')

Request a Contract ID

CONTRACT_ID=$(curl --request GET 'https://api.satellogic.com/contracts' \
--header "authorizationToken: Bearer $ACCESS_TOKEN" | jq -r '.[0].contract_id')

Adjust jq -r '.[0].contract_id' with the correct contract index.

Download all the assets for a specific outcome_id

stac-client search https://api.satellogic.com/archive/stac/ \
    --filter '{"op": "=","args": [ { "property": "satl:outcome_id" }, "c44cb3c7-9328-4215-9be4-5386e01edafd--175631" ]}' \
    --collection 'quickview-visual' \
    --headers "authorizationToken=Bearer $ACCESS_TOKEN" "X-Satellogic-Contract-Id=$CONTRACT_ID"\
    | stac-asset download -i analytic

Here the first command, using stac-client will fetch all the matching tiles for the outcome_id that we are interested in. We will then pipe the result to stac asset and tell the tool to just download the analytic asset for each of the tiles.

More examples can be found on the stac-asset documentation page.