Earth Engine Apps

Obtaining an API Key

You will need to create a Cloud Project for every app that you launch, and configure an API Key on the project. The API Key is used to identify the project to Earth Engine, so that traffic from your app can be monitored. If Earth Engine servers become overloaded, traffic will be restricted on a per-project basis.

There are four steps to follow:

  • Click Create API Key.
  • Enter a new project name based on the name of your app, such as "EE App SampleApp", and hit NEXT.
  • Click to copy the new key, and paste it into the Publish App dialog in the Code Editor.
  • (Recommended) Click the API Console link under the new key to set referrer restrictions. See below for more details.

Create API Key

Enter project name Key ready

Adding Referrer Restrictions

Referrer restrictions ensure that only the designated app(s) can use your key. If an app has a key with restrictions that do not match the app URL, you will see the error "Failed to initialize with EE API". You can set or edit referrer restrictions at any time by visiting the Credentials page on the Cloud Console:
  • Make sure the correct project name is selected in the dropdown at the top of the screen.
  • Click the API key name to view details for the key.
  • Select HTTP referrers (websites), and paste in the full URL that appears in the Publish App/App Details dialog: https://{you}.users.earthengine.app/view/{app name}.
  • Hit Save. The "Saving..." indicator should appear.
You may also replace {app name} in the URL with *, to allow the key to be used by multiple apps, but this is not recommended.
Add referrers