Use Portal Basemaps

Explore in the sandboxView live

You can create Basemaps in your ArcGIS API for JavaScript applications using a Portal. In doing so, you can leverage your organizations default basemap or default vector basemap. You can define the portalUrl in the esriConfig and the BasemapGallery widget will use the configured basemaps in that portal.

1. Initialize a Portal Instance

// Default is portal for
var portal = new Portal();

2. Load Portal Resources

// If you define the Portal URL in esriConfig, the
// BasemapGallery widget can determine which basemaps
// to use.
esriConfig.portalUrl = "";
// Initialize a portal instance and load it
var portal = new Portal();
  .then(function() {
    // A portal can be configured to use Vector Basemaps
    // by default or not.
    var basemap = portal.useVectorBasemaps ?
          portal.defaultVectorBasemap : portal.defaultBasemap;
    var map = new Map({
      basemap: basemap
    var view = new MapView({
      container: "viewDiv",
      map: map,
      center: [-118.24, 34.073],
      scale: 10000
    // The BasemapGallery will use the basemaps
    // configured by the Portal URL defined in esriConfig.portalUrl
    var basemapGallery = new BasemapGallery({
      view: view
    var bgExpand = new Expand({
      view: view,
      content: basemapGallery
    view.ui.add(bgExpand, "top-right");
  .catch(function(error) {

This allows you to use your organization settings to create consistent applications across your organization.