Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • Built-in tools
  • Webhooks & Code
  • Code

Store data from code steps with StoreClient

Written by Owner

Updated at August 20th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Tables
    Work with tables Manage tables Create tables Troubleshoot Zapier Tables
  • Product updates
    Product updates: January 2023 Product updates: March 2023 Product updates: February 2023 Product updates: April 2023 Product updates: May 2023 Product updates: June 2023 Product updates: July 2023 Product updates: August 2023 Product updates: September 2023 Product updates: October 2023 Product updates: November 2023 Product updates: December 2023 Product updates: January 2024 Product updates: February 2024 Product updates: March 2024 Product updates: April 2024 Product updates: May 2024 Product updates: June 2024 Product updates: July 2024 Product updates: August 2024 Product updates: September 2024 Product updates: October 2024 Product updates: November 2024 Product updates: December 2024 Product updates: January 2025 Product updates: February 2025 Product updates: March 2025 Product updates: April 2025 Product updates: May 2025 Product updates: June 2025 Product updates: July 2025 Product updates: August 2025
  • Zaps
    Zap basics Zap history Troubleshoot Zaps Manage your Zaps Do more with Zaps
  • Your Zapier account
    Plans Billing Account profile Notifications Data privacy & security Get help User roles and permissions
  • Interfaces
    Troubleshoot Zapier Interfaces Create an interface Use interface components Manage interfaces
  • Canvas
    Create a canvas Collaborate on a canvas
  • Chatbots
    Add logic and knowledge to chatbots Troubleshoot chatbots Create chatbots Manage chatbots
  • Getting started
    Intro to Zapier Set up your Zapier account Use case templates
  • Agents
    Create agents Manage agents Troubleshoot agents
  • MCP
    Set up MCP
  • Built-in tools
    Filter & Paths Formatter Schedule & Delay Email, IMAP, SMTP, & Email Parser Webhooks & Code Storage, Digest, & RSS Sub-Zap & Looping Other built-in tools Custom Actions & API Requests Functions AI by Zapier & AI actions Copilot Human in the Loop
  • Lead Router
    Create routers
  • Apps
    Connect and manage your app connections AI apps on Zapier Apps on Zapier
+ More

Table of Contents

Limitations 1. Set a secret for the StoreClient 2. Use the StoreClient with JavaScript steps 3. Get and set values with JavaScript 4. Bulk operations with JavaScript 5. Use the StoreClient with Python steps 6. Get and set values with Python 7. Bulk operations with Python 8. Other Python operations

The StoreClient is a built-in utility available in both Python and JavaScript code steps that lets you store and retrieve data between Zaps or between runs of the same Zap.

Limitations

  • Any JSON serializable value can be saved.
  • The secret should use UUID4 format.
  • Every key must be less than 32 characters in length.
  • Every value must be less than 2500 bytes.
  • Only 500 keys may be saved per secret.
  • Keys will expire if you do not touch them in 3 months.

1. Set a secret for the StoreClient

First, you'll need to provide a secret that will protect your data. Your secret should use UUID4 format. We recommend using this Online UUID Generator Tool to generate your secret.

2. Use the StoreClient with JavaScript steps

Instantiating a client is very simple:

var store = StoreClient('your secret here');
miscEye icon Note

StoreClient is a promise-based library and a great time to get familiar with async and await!

3. Get and set values with JavaScript

Most likely you just want to get and set some values - this is the simplest possible example:

const store = StoreClient('your secret here');
await store.set('hello', 'world');
const value = await store.get('hello');
return {result: value} // value === 'world'

If the value doesn't exist during your get() call, it will return a null value.

4. Bulk operations with JavaScript

You can also save and retrieve multiple keys and values - a slightly more complex example:

const store = StoreClient('your secret here');
await store.setMany({hello: 'world', foo: 'bar'})
const values = await store.getMany('hello', 'foo');
// values === {hello: 'world', foo: 'bar'}
await store.deleteMany('hello', 'foo');
// or, if you want to wipe everything
await store.clear();

Note, you can call getMany and deleteMany in a few different ways:

store.getMany('hello', 'foo'); // as arguments
store.getMany(['hello', 'foo']); // as array
store.getMany({hello: null, foo: null}); // as object

5. Use the StoreClient with Python steps

When working with StoreClient, as for all Python Code steps, you will need to return a dictionary or an array of dictionaries. Returning a string will result in an error.

store = StoreClient('your secret here')

6. Get and set values with Python

Most likely you just want to get and set some values. This is the simplest possible example:

store = StoreClient('your secret here')
store.set('hello', 'world')
value = store.get('hello') # return 'world'
store.delete('hello')

If the value doesn't exist during your get() call, it will return a None value.

7. Bulk operations with Python

You can also save and retrieve multiple keys and values - a slightly more complex example:

store = StoreClient('your secret here')
store.set_many({'hello': 'world', 'foo': 'bar'})
values = store.get_many('hello', 'foo') # return {'hello': 'world', 'foo': 'bar'}
store.delete_many('hello', 'foo')
store.clear() # or, if you want to wipe everything

Note, you can call get_many and delete_many in a few different ways:

store.get_many('hello', 'foo') # as args
store.get_many(['hello', 'foo']) # as list
store.get_many({'hello': None, 'foo': None}) # as dict

And similarly with set_many:

store.set_many({'hello': 'world', 'foo': 'bar'}) # as dict
store.set_many(hello='world', foo='bar') # as kwargs

8. Other Python operations

Slightly more complex examples include incrementing a numeric value, setting a value if a condition is met or pushing/popping from lists. These operations also have the benefit that they are atomic.

increment_by increments a value found under a given key. The value has to be a numeric value in order for this operation to succeed:

store.increment_by(key, amount)

set_value_if sets a value if a condition is met. If the value stored under the given key matches the same value as the given previous value, then the given value parameter will become the new value of the key.

store.set(key, 1) # set a value
# sets 2 only if the previous value of *key* is 1
store.set_value_if(key, value=2, previous_value=1)

set_child_values/remove_child_values can be useful for storing/removing nested values. The value under the given key has to be a dictionary.

```python
store.set_child_values(key, {'a': 'b'}) # store under the given key the key `a` with value `b`
store.remove_child_values(key, ['a', 'c']) # remove the keys `a` and 'c' from the mapping found at `key`

list_pop/list_push can be useful for manipulating lists.

store.list_push(key, some_value)
store.list_pop(key)

Additionally, list_push and list_pop accept a location parameter.

store.list_push(key, value, location='tail') # Push to the tail of the list
store.list_push(key, value, location='tail_set') # Push to the tail of the list only if the value is not already in the list
store.list_push(key, value, location='head') # Push to the head of the list
store.list_push(key, value, location='head_set') # Push to the head of the list only if the value is not already in the list
store.list_pop(key, location='tail') # Pop from the end of the list
store.list_pop(key, location='head') # Pop from the head of the list

list_pop can also receive a default parameter, which will be returned when there is nothing to pop from the given list:

store.list_pop(key, default=1, location='tail')

You can also access stored data via the storage REST API.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Generate a Code step using AI (Beta)
  • Code by Zapier rate limits
  • JavaScript code examples in Zaps
  • Python code examples in Zaps
  • Use JavaScript code in Zaps

Copyright 2025 – OBZ-Zapier.

Knowledge Base Software powered by Helpjuice

Expand