Examples

last updated: October 02, 2024

The Planet Tasking API is a REST based API, which can be integrated into any service, regardless of the language used.

Authentication

The Planet API uses Basic HTTP Authentication and requires that you have a Planet API key. To obtain an API key for Planet's high resolution tasking, please contact a Planet sales representative.

Once you have an API key, it should be added into the headers of any request made to the Tasking API endpoints. If using curl then the following would be an example of this:

--header 'authorization: api-key <YOUR_API_KEY>'

An example of Basic HTTP Authentication with Python is included below:

import os
# import os module to access enviornmental modules

import requests
from requests.auth import HTTPBasicAuth
# import helper functions to make Basic request to Planet API

PLANET_API_KEY = os.getenv('PL_API_KEY')
# Setup the API Key from the `PL_API_KEY` environment variable

BASE_URL = 'https://api.planet.com/tasking/v2/orders/'

if PLANET_API_KEY is None:
  PLANET_API_KEY = '12345'
#pass in your API key

auth = HTTPBasicAuth(PLANET_API_KEY, '')
# HTTPBasicAuth() wants a username & password; you can pass an empty string for the password

res = requests.get(url=BASE_URL, auth=auth)

print(res.status_code)
# make a request to the Tasking API and test response

Formatting

All requests and responses use the JSON format, and uses snake_case as the naming convention.

Headers

The only header, apart from the Authorization header as mentioned above, that is required is the content-type, which should look like this:

--header 'Content-Type: application/json'

GeoJSON

All the geographical coordinate definitions in the Tasking API follow the GeoJson format

Version

The current version of the API can be found via the url https://api.planet.com/tasking/v2/version.txt



We are continually working to improve our technical documentation and support. Please help by sharing your experience with us.

Send Us Your Feedback