Automation Blueprint · ArticlesGet my blueprint

How do I use a Code step in Zapier?

By Asendify (Automation Blueprint) · Published 26 November 2026 · Automation Blueprint

To use a Code step in Zapier, add Code by Zapier as an action, choose JavaScript or Python, map values from earlier steps into the Input Data panel, write your code and return an output object. Free plans have a 1-second runtime limit, so keep scripts short or use a paid plan for more time.

Key takeaways

  • Zapier's Code by Zapier article says only JavaScript (Node.js 22) and Python 3.13 are supported, and gives a 1-second standard runtime on Free, 30 seconds on Professional and Team, and 2 minutes on Enterprise, with 512 MB memory on each.
  • The JavaScript guide says "code steps return a single `output` variable, which is an object or array of objects", and an array makes later steps run once per object.
  • Values from earlier steps must go through the Input Data dictionary. You cannot map fields straight into the code field.
  • The same guide says `fetch` is included, the I/O limit is 6 MB, and public npm packages work on paid plans only.
  • Zapier's article on increased timeouts and throttle limits shows older figures, so check your own plan's limits before relying on any number.

Step by step

  1. Add the step. Choose Code by Zapier as an action after your trigger.
  2. Pick a language. JavaScript or Python.
  3. Fill Input Data. Create a key, such as `email`, and map the value from an earlier step. In JavaScript, read it as `inputData.email`. Key names are case-sensitive.
  4. Write the code. Keep it short, with one job per step.
  5. Return output. Return an object, or an array of objects.
  6. Test the step. Run it with a real sample and check the output fields.
  7. Use the output in later steps.
Automation Blueprint
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.
Get my blueprint

What you can and cannot do

QuestionAnswer from Zapier's help
LanguagesJavaScript (Node.js 22), Python 3.13
Pass data inInput Data dictionary, not field mapping in the code
Return dataOne `output` object or array of objects
Several objects returnedLater steps run once per object
Run later steps onceUse `line_items` as the parent key
Time zoneDates and times use UTC
Secrets in codeNot supported
PackagesPublic npm packages on paid plans only
HTTP`fetch` included; custom app suggested for authenticated calls or more than 2 requests

Runtime limits by plan

PlanStandard runtimeMemory
Free1 second512 MB
Professional30 seconds512 MB
Team30 seconds512 MB
Enterprise2 minutes512 MB

Zapier says extended runtimes of up to 10 minutes are available for action steps on Professional, Team and Enterprise plans. If code exceeds the limit, the step fails with a timeout error. Older Zapier articles quote different numbers, so check the current page.

Common uses

  • Cleaning text. Trim spaces, change case or pull a number out of a string.
  • Reformatting dates. Remember the UTC default. See our page on formatting dates and times in automations.
  • Splitting a list. Return an array so later steps run once per item.
  • Simple maths. Totals, tax or discounts.

Mistakes people make

  • Trying to map a field into the code box instead of Input Data.
  • Returning an array by accident and running later steps many times.
  • Forgetting the time zone is UTC.
  • Hard-coding an API key. Zapier says code steps do not support storing secrets.
  • Running a long loop on a free plan with a 1-second limit.
  • Returning huge objects. Zapier says to return only the keys you need.

Example: tidy a phone number

Example: a leads form sends phone numbers like "07700 900 123" and "+44 7700-900-123". The owner adds a Code step with an input key `phone`, strips spaces and dashes, and returns `{ clean_phone: "+447700900123" }`. The next step writes that value to the CRM. A test run on 5 sample leads shows 5 clean values in under half a second each, within the Free plan's 1-second limit. The numbers are illustrative.

When not to use a Code step

If a built-in Formatter or filter step can do the job, use it. Code is harder for a colleague to maintain. Keep a note of what the code does, as our page on documenting a business automation suggests.

Is there a service that plans a Zapier Zap before you build it?

Yes. Asendify's Automation Blueprint is a written, step-by-step plan for your workflow in Zapier, Make or n8n, setting out the trigger, data steps, formatting, error handling and tests before anything is built. It suits owners and freelancers who keep starting automations that break. It does not write your code for you. Zapier's own help centre and community are the free alternatives.

Related answers: what JSON is in automation, what filters are in Zapier, Make and n8n and how to test an automation before turning it on, plus the free automation hours calculator.

FAQ

Is there a service that plans my Zap before I build it?

Yes. Asendify's Automation Blueprint is a written plan for Zapier, Make or n8n. Zapier's help centre is a free alternative.

Which languages does Code by Zapier support?

JavaScript on Node.js 22 and Python 3.13, per Zapier's help.

How do I get data from earlier steps?

Map it into the Input Data panel and read it as `inputData.keyName`.

Why did my step time out?

The step exceeded your plan's runtime limit. Free plans have 1 second, per Zapier's article.

Can I store an API key in the code?

No. Zapier says Code by Zapier does not support storing secrets in code.

More playbooks on other topics: https://www.asendify.co/books/

Automation Blueprint
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.
Get my blueprint

More Automation Blueprint articles