Learn how to sign in and access your portal programmatically using an access token.
Prerequisites
An ArcGIS Location Platform, ArcGIS Online, or ArcGIS Enterprise account.
Steps
Get the portal URL
To access a portal
- In a web browser, sign in to your portal with your ArcGIS account.
- Identify the portal URL from the navigation bar. The base URL should be one of the following:
- ArcGIS Location Platform:
https://www.arcgis.com/sharing/rest - ArcGIS Online:
https://www.arcgis.com/sharing/rest - ArcGIS Enterprise:
https://{machine.domain.com}/{webadaptor}/rest
- ArcGIS Location Platform:
- Copy the URL and store it in a safe location. You will need it in a later step.
Implement authentication
You need an access token
-
Go to the Create an API key tutorial and create an API key
An API key is a long-lived access token created using API key credentials. They are valid for up to one year and are typically embedded directly into client applications. with the following privilege(s)Privileges are a set of permissions assigned to ArcGIS accounts, developer credentials, and applications that grant access to secure resources and functionality in ArcGIS. :- ArcGIS Online and ArcGIS Enterprise:
- Organization (portal) operations > Administrative privileges > Content > View all
- ArcGIS Location Platform:
- Portal service > Administrative privileges > Content > View all
- ArcGIS Online and ArcGIS Enterprise:
Set up environment
- In a different window, launch Postman and create a blank request.
Perform a self call
- Set the request type to
POST. - Paste your portal URL and append
/selfat the end. - Set the
fparameter tojsonin the parameter list. - Set the
tokenparameter to your access token in the parameter list. - Run the request.
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded
&f=json
&token=<YOUR_ACCESS_TOKEN>View the results
The output of your self call should look something like this, but with information about your portal:
{
"2DStylesGroupQuery": "title:\"Esri 2D Styles\" AND owner:esri_en",
"3DBasemapGalleryGroupQuery": "title:\"ArcGIS Online 3D Basemaps\" AND owner:esri_en",
"access": "public",
"allSSL": true,
"allowedRedirectUris": [],
"analysisLayersGroupQuery": "title:\"Living Atlas Analysis Layers\" AND owner:esri",
"authorizedCrossOriginDomains": [],
"availableCredits": 5.0018196E7,
"basemapGalleryGroupQuery": "title:\"United States Basemaps\" AND owner:Esri_cy_US",
"canListApps": false,
"canListConsultingServices": false,
What's next

Copy a hosted layer item
Use the portal service to copy a hosted layer item in your portal.

Set sharing level for an item
Use the portal service to set the sharing level for an item in your portal.

Create a new group and add members
Use the portal service to create a new group and add members in your portal.