Map without API key

10-11-2021 01:07 PM
New Contributor III

I wrote some code that creates a map and allows users to click on the map. The click takes the lat,lng (of click) and queries a government's GIS database and returns the parcel number. They can also use the default search widget and search by address, which ultimately does the same thing. 

I also added a polygon layer that outlines parcels and another polygon layer that outlines houses. 

I am NOT USING AN API KEY. I am NOT using esriConfig. 

The code works and seems fairly easy to disseminate. I just add:

<script src=""></script>

And the code just works. Basemap layers and Geocoding are a part of the Pricing, although nothing is stopping my code from running. 

The Questions is: Do I still need an API key? If so, does the search widget use a Geocoding credit? Does the adding a layer or loading the basemap use a Basemap credit? 
If not, why not? (But also not complaining)

Extra Info:
To Query I use -> {featurelayerlink}/query?
geometry={lat} {lng}&...etc
To Add a Layer I use -> map.add(
new FeatureLayer({          url: featureLayerURL, ...etc    }))
To Make the map -> map = new Map({        basemap: "streets",      });
Tags (4)
0 Kudos
5 Replies
Esri Regular Contributor

Hi @ScottAndersonGQ - as for your question about "Do I need an API key?":

That depends on your account.  If you are using an ArcGIS Developer account, then yes, you need an API key. If you are using an ArcGIS Online account, then no, API key is not required.
As shown on that page, if you're using an ArcGIS Online account, then "Basemap layers" and "Geocoding (not stored)" does not consume credits.

New Contributor

I also came across the same situation while configuring my application to use a token-based authentication from ArcGIS Enterprise. 

If you check this codepen you can see what we mean.

There is no code to input an API key nor a token and yet the map loads without a problem.

All the basemaps from this documentation section works without authentication.

"For use without an API key
Use of these basemaps requires a valid ArcGIS Online organizational subscription or an ArcGIS Enterprise license."


Is it correct to assume these base maps don't need authentication of any kind to be loaded? If so, will it continue to be accessible in the future in the same manner?

0 Kudos
Esri Regular Contributor

If you have an ArcGIS Enterprise license , you can legally use the basemaps listed under "For use without an API key"  - and your application does not need to specify an API key.

@LeandroAlmeida - does this help clarify?

New Contributor

Thanks for the reply, Bjorn

I understand API Keys are just for ArcGIS Online and Enterprise should use token or OAuth authentication, but what I don't understand is what tells ArcGIS that I really have a license in the first place if I can go to codepen or any other site and just input a code with no reference to my enterprise account whatsoever?

  • Is it just for demonstration/testing purposes?
  • If so, why the maps accessible with the API key is not open for testing as well?
  • Does this approach without a key or token have any limits to how much the application can consume?

I'm asking all these questions because if we can just ship out a code without any API/token reference that's the way we will take it since we won't have to deal with another endpoint to handle authentication (we are using client_credentials tokens).

I just want to be certain that this approach will keep working in the future, in order to keep our site running without problems.

Just to give you a context, the website in question is only using the base map, all the other layers are being generated on the client side.


Esri Regular Contributor

Hi @LeandroAlmeida 
Technically there is nothing that tells ArcGIS that you indeed have an Enterprise license. It's a "paper" license. The terms are described in details in the E300 MLA -   
There's no special limits for using this keyless/tokenless approach - assuming you have the license.

We don't currently have any plans to change that as far as I know.