The following function uses a gis object created by authenticating with an api key developer credential. The line uses a spatially enabled dataframe (SEDF) to overwrite a feature layer in AGOL. It was working successfully until the AGOL security updates to developer credentials in early-mid April 2026. Now it appears the code cannot successfully access the folder containing the feature layer even though the api key has full access (although not recommended), and specifically has access to the feature layer.
zips_to_append_sedf.spatial.to_featurelayer(gis=gis,sanitize_columns=True, overwrite=True,
service=service_info)
Error message:
User is anonymous, exiting
Traceback (most recent call last):
File "C:\Users\xyz\AppData\Local\ESRI\conda\envs\arcgispro-py3-automated_workflows\Lib\site-packages\IPython\core\interactiveshell.py", line 3579, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-e7550eae93a9>", line 1, in <module>
zips_to_append_sedf.spatial.to_featurelayer(gis=gis, sanitize_columns=True, overwrite=True,
File "C:\Users\xyz\AppData\Local\ESRI\conda\envs\arcgispro-py3-automated_workflows\Lib\site-packages\arcgis\features\geo\_accessor.py", line 2459, in to_featurelayer
result = content.import_data(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xyz\AppData\Local\ESRI\conda\envs\arcgispro-py3-automated_workflows\Lib\site-packages\arcgis\gis\__init__.py", line 9029, in import_data
return _cm_helper.import_as_item(self._gis, df, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xyz\AppData\Local\ESRI\conda\envs\arcgispro-py3-automated_workflows\Lib\site-packages\arcgis\gis\_impl\_content_manager\_import_data.py", line 271, in import_as_item
file_item, new_item = _create_items(gis, file, file_type, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xyz\AppData\Local\ESRI\conda\envs\arcgispro-py3-automated_workflows\Lib\site-packages\arcgis\gis\_impl\_content_manager\_import_data.py", line 151, in _create_items
file_item = folder.add(
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'add'
@Noah-Sager @John-Foster Tagging you guys because you were tagged on other api key issue posts. Like this one: API key using user role not key privileges - Esri Community.
The issue presented in that thread seems pretty severe exposure of resources, and my issue seems like a severe lock down, so a move in the opposite direction... no access even though it was specifically granted to the key.
Hey @BenCapell_nwtf, thanks for the message. Have you verified that the old API Key still works outside of that script? Have you tried creating a new API Key since the update? This is not truly my area of expertise, I just try to be helpful.
Your issue may be related to the recent security patch. Most likely you need to create a new API key with all the same permission scopes you currently have set, plus add the Create, update, and delete privilege from the Content group: