A Shopify Flow action extension is two things: a flow_action entry in shopify.extension.toml and an HTTPS endpoint in your app. Shopify documents the exchange: when a merchant’s workflow reaches your step, Flow POSTs a signed JSON payload to the endpoint, waits up to 10 seconds, and reads your status code to decide whether the step succeeded, failed for good, or is sent again.
Choosing that status code is most of the job, because several replies, 202 among them, make Flow send the same request again. We ran the handler below against @shopify/shopify-app-react-router 4.0.6 with requests we signed ourselves. We did not deploy it or run it from a workflow, so every statement about what Flow does comes from Shopify’s documentation as it read in December 2026.
What does a Shopify Flow action extension need in its TOML?
Shopify’s guide to creating an action has shopify app generate extension write the file. Edited for an action that sends an order to a warehouse system, following the configuration reference, it reads:
[[extensions]]
name = "Send order to warehouse"
type = "flow_action"
handle = "send-to-warehouse"
description = "Send the order to the warehouse system"
runtime_url = "/api/flow/actions/send-to-warehouse"
[settings]
[[settings.fields]]
type = "order_reference"
required = true
[[settings.fields]]
type = "single_line_text_field"
key = "service"
name = "Delivery service"
description = "Leave empty for the warehouse default"
required = false
handle is the name Flow sends back in the request, so it is how one endpoint tells several actions apart. The docs warn that some legacy workflows, from before handles existed, leave it out. The route below rejects those. runtime_url is where the request goes. Since June 2026 it can be a path starting with a single /, which Shopify CLI resolves against your tunnel during app dev and against application_url on deploy.
Fields come in two kinds. A reference field such as order_reference has no key. Flow fills it from the workflow and sends it under a fixed name, order_id here. The reference says the app must hold read_orders to use it. A custom field is one the merchant fills in, under a key you choose. The custom types are single_line_text_field, multi_line_text_field, number_integer, number_decimal, boolean, email and url.
One limit applies before any of this: an action in a custom app only appears on Plus stores and on development stores on the Plus plan, the same rule our post on Flow trigger extensions covers for triggers.
What does Flow send to runtime_url?
A POST with a JSON body. This is the shape the endpoints page documents, with our field names in it:
{
"shop_id": "1",
"shopify_domain": "example.myshopify.com",
"action_run_id": "xxxx-xxxx-xxxx-xxxx",
"action_definition_id": "Send order to warehouse",
"handle": "send-to-warehouse",
"properties": {
"order_id": "gid://shopify/Order/1234567",
"service": "next-day"
}
}
properties holds your fields, and a reference field arrives as an Admin API GID. Do not assume the object matches the TOML you deployed last. Shopify’s page on updating an action says existing steps “keep sending requests to your endpoint using their previously configured fields” until the merchant saves them again. A field you added may be missing, and one you removed may still arrive.
Changing a field’s type in place is worse. According to the same page those runs fail before Flow calls your endpoint at all, which leaves your code nothing to catch. Add a new field instead.
How do you verify the request?
The endpoints page says Flow sends an HMAC of the payload, keyed on your app’s client secret, in x-shopify-hmac-sha256, and that the check “works the same as webhooks”. Shopify’s helper agreed in our runs: it accepted a base64 digest of the raw body and refused a hex one. On any other stack, use the function in our post on verifying Shopify webhook HMACs.
In a React Router app, authenticate.flow does it and returns the payload, an offline session and an admin client.
Its failures all look the same from outside. In 4.0.6 a signature from the wrong secret, a missing header and a body re-serialised after signing each made it throw a 400 Bad Request with an empty body. So did a correctly signed request for a shop with no offline session in session storage. The reference describes session and admin as “Returned only if there is a session for the shop”, but in our runs the call threw before returning anything. Only the server log tells the two apart: invalid_hmac or missing_hmac at error level for the signature, Flow request could not find session at info level for the shop.
That second case is the one to watch after moving an app’s session storage. A shop whose row did not make the move gets an empty 400 on every run.
Which status codes make Flow retry?
The endpoints page gives a table. Condensed:
| Your reply | What the docs say Flow does |
|---|---|
| 200 | Treats the request as processed |
| 202 | Treats it as accepted but not processed, and resends at increasing intervals for up to 36 hours |
| 429 | Resends, treating a Retry-After of 5 to 3,600 seconds as a minimum wait |
| Any other 4XX | Fails the step, does not resend, and shows the merchant your response body |
| 5XX | Resends at increasing intervals for up to 36 hours |
| No reply in 10 seconds | Closes the connection and resends later |
| Anything else | Fails the step and does not resend |
A 202 does not end the conversation. Shopify’s own note describes “returning a 202 Accepted status code followed by a 200 OK status code when complete”, which makes 202 one half of a polling loop. Going by the table, an endpoint that queues the job, answers 202 and never answers 200 is sent the same request for a day and a half.
Read literally, the last row also catches 201, 204 and any redirect. We have not tried those against Flow. Return 200.
The empty 400 that authenticate.flow throws lands in the “any other 4XX” row: no retry, and nothing for the merchant to read. For failures you raise yourself, the docs let you add a message key to the JSON body as a description written for the merchant.
How do you stop a retry running the action twice?
Every request carries an action_run_id, which the docs offer as an idempotency key because “your app could receive an identical request more than once”. Put that together with the table and the handler is a small state machine. First the record of runs:
type Run = {
state: 'running' | 'done' | 'rejected' | 'retry';
message?: string;
settled: Promise<void>;
};
const KEEP_MS = 48 * 60 * 60 * 1000;
const runs = new Map<string, Run>();
export class Rejected extends Error {}
export function claimRun(id: string, work: () => Promise<void>): Run {
const known = runs.get(id);
if (known) return known;
const run: Run = {state: 'running', settled: Promise.resolve()};
run.settled = Promise.resolve()
.then(work)
.then(
() => {
run.state = 'done';
},
(error: unknown) => {
if (error instanceof Rejected) {
run.state = 'rejected';
run.message = error.message;
} else {
run.state = 'retry';
runs.delete(id);
}
},
);
runs.set(id, run);
setTimeout(() => runs.delete(id), KEEP_MS).unref();
return run;
}
Then the route, in app/routes/api.flow.actions.send-to-warehouse.ts:
import {setTimeout as sleep} from 'node:timers/promises';
import type {ActionFunctionArgs} from 'react-router';
import {claimRun} from '../flow-runs.server';
import {authenticate} from '../shopify.server';
import {sendToWarehouse} from '../warehouse.server';
const DEADLINE_MS = Number(process.env.FLOW_DEADLINE_MS ?? 8_000);
const reply = (status: number, message?: string) =>
Response.json(message ? {message} : {}, {status});
export const action = async ({request}: ActionFunctionArgs) => {
const {payload} = await authenticate.flow(request);
if (payload.handle !== 'send-to-warehouse') {
return reply(400, 'Unknown action.');
}
const orderId = payload.properties?.order_id;
if (typeof orderId !== 'string') {
return reply(400, 'This step has no order. Open the step and save it again.');
}
const service = payload.properties.service || 'standard';
const run = claimRun(payload.action_run_id, () =>
sendToWarehouse(payload.shopify_domain, orderId, service),
);
await Promise.race([run.settled, sleep(DEADLINE_MS, null, {ref: false})]);
if (run.state === 'done') return reply(200);
if (run.state === 'rejected') return reply(400, run.message);
if (run.state === 'retry') return reply(503);
return reply(202);
};
claimRun starts the work once for each run ID and hands the same record to every resend. The route waits up to eight seconds, inside Flow’s ten, then reports where the run stands. sendToWarehouse is your own code; throw Rejected from it when a retry cannot help, and its message goes back in the 400.
We called the action directly with signed requests. Work that finished at once returned 200, and a resend returned 200 without running it again. With 200 ms of work and the deadline set to 50 ms, three sends returned 202, 202 and 200, and the work ran once. A Rejected error returned 400 with its message on both sends. Any other error returned 503, and the resend ran the work again.
That last path has a hole. A timeout can arrive after the warehouse took the order, and the retry then sends it twice. If the system you call accepts an idempotency key, pass it the run ID as well.
The Map only holds for one long-lived process. With several instances, or on a serverless host where nothing keeps a promise alive after the response, the claim has to be a row with a unique action_run_id and the work has to go to a queue. Keep the rows longer than the 36 hours Flow may keep asking. The sample keeps them for 48.
When is a Flow action the right tool?
Build one when the merchant should decide when your app acts: which orders, after which conditions, next to which other steps. If your app has to act on every order whether or not anyone built a workflow, subscribe to the webhook yourself and leave Flow out of it.
Before shipping, run the action from a real workflow on a development store with the endpoint made slow, then made to fail. That is the half we could not test here: whether the resends arrive the way the documentation describes.
Whoooop builds and customises Shopify stores and connects them to accounting, shipping and email systems, which is the kind of job the action above does. Our Shopify development page describes that work.