Python Example
import requests
import json
# 0. Complete the following section with your client id and secret
client_id = ""
client_secret = ""
# 1. Get the access token for your API Credentials
access_token_url = "https://auth.platform.satellogic.com/oauth/token"
payload = json.dumps({
"client_id": client_id,
"client_secret": client_secret,
"audience": "https://api.satellogic.com/",
"grant_type": "client_credentials"
})
headers = {
'Content-Type': 'application/json'
}
access_token_response = requests.post(access_token_url, headers=headers, data=payload)
access_token_response.raise_for_status()
access_token = access_token_response.json().get('access_token')
# 2. Get your contracts.
ALEPH_API_URL = "https://api.satellogic.com"
contracts_uri = "/contracts/"
contracts_response = requests.get(
f"{ALEPH_API_URL}{contracts_uri}",
headers={
'AuthorizationToken': f'Bearer {access_token}',
})
contracts_response.raise_for_status()
contracts = contracts_response.json()
print("Your contracts are: ")
print(contracts)
# 4. Save the contract_id for future requests
# For this example we will use the first available contracts, but there can me many.
your_contract_id = contracts[0]['contract_id']
# 3. List your tasks for tasking imagery
tasks_uri = "/tasking/tasks/"
tasks_response = requests.get(
f"{ALEPH_API_URL}{tasks_uri}",
headers={
'AuthorizationToken': f'Bearer {access_token}',
'X-Satellogic-Contract-Id': your_contract_id,
},
)
tasks_response.raise_for_status()
tasks = tasks_response.json()
print("Your tasks are: ")
print(tasks)
# 4. List your available stac collections for archive imagery
stac_collections_uri = "/archive/stac/collections/"
stac_response = requests.get(
f"{ALEPH_API_URL}{stac_collections_uri}",
headers={
'AuthorizationToken': f'Bearer {access_token}',
'X-Satellogic-Contract-Id': your_contract_id,
},
)
stac_response.raise_for_status()
stac_collections = stac_response.json()
print("Your available STAC collections are: ")
print(stac_collections)