Retrieves one or more items from the storage area.

This is an asynchronous function that returns a Promise.


let gettingItem =<storageType>.get(
  keys    // null, string, object or array of strings

<storageType> will be one of the writable storage types — storage.sync or storage.local.


A key (string) or keys (an array of strings or an object specifying default values) to identify the item(s) to be retrieved from storage. If you pass an empty string, object or array here, an empty object will be retrieved. If you pass null, or an undefined value, the entire storage contents will be retrieved.

Return value

A Promise that will be fulfilled with a results object containing every object in keys that was found in the storage area. If the operation failed, the promise will be rejected with an error message.

When used within a content script in Firefox versions prior to 52, the Promise returned by is fulfilled with an Array containing one Object. The Object in the Array contains the keys found in the storage area, as described above. The Promise is correctly fulfilled with an Object when used in the background context (background scripts, popups, options pages, etc.). When this API is used as, it correctly passes an Object to the callback function.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic supportYesYes45.048.033


Suppose storage contains two items:

// storage contains two items,
// "kittens" and "monsters"{
  kitten:  {name:"Mog", eats:"mice"},
  monster: {name:"Kraken", eats:"people"}

Define success and failure handlers for the promise:

function onGot(item) {

function onError(error) {
  console.log(`Error: ${error}`);

With no keys argument, retrieve everything:

let gettingItem =;
gettingItem.then(onGot, onError);

// -> Object { kitten: Object, monster: Object }

With an empty keys argument, return nothing:

// with an empty array, retrieve nothing
let gettingItem =[]);
gettingItem.then(onGot, onError);

// -> Object { }

With the name of an object, retrieve the match:

let gettingItem ="kitten");
gettingItem.then(onGot, onError);

// -> Object { kitten: Object }

With an array of object names, retrieve all matches:

let gettingItem =["kitten", "monster", "grapefruit"]);
gettingItem.then(onGot, onError);

// -> Object { kitten: Object, monster: Object } 

With an object with object names as keys and the default value as value:

let gettingItem ={
  kitten: "no kitten",
  monster: "no monster",
  grapefruit: {
    name: "Grape Fruit",
    eats: "Water"

// -> Object { kitten: Object, monster: Object, grapefruit: Object }

Chrome examples"kitten", function(items){
  console.log(items.kitten);  // -> {name:"Mog", eats:"mice"}

Or with an arow function"kitten", items=>{
  console.log(items.kitten); // -> {name:"Mog", eats:"mice"}

This API is based on Chromium's API. This documentation is derived from storage.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Last updated by: wbamberg,