# Claude Code + Pocketsflow Source: https://docs.pocketsflow.com/ai-tools/claude-code Connect Claude Code to the Pocketsflow MCP server and docs so you can build integrations, automate your store, and query your account from the terminal. [Claude Code](https://www.anthropic.com/claude-code) is Anthropic's official CLI coding agent. Connect it to Pocketsflow's **MCP server** and it can act on your account directly — create products, read orders, set refund policies, manage webhooks, and send newsletters — while also using the docs as context to write integration code for you. > [!NOTE] > > **Prerequisites** > > * Claude Code installed (`npm install -g @anthropic-ai/claude-code`). > * A Pocketsflow account. No API key needed to connect: you approve Claude > Code with your Pocketsflow login. ## Two ways to use it > [card] Act on your account (MCP) > > Connect the Pocketsflow MCP server so Claude Code can call the API as your > account — no client code required. > [card] Write integration code > > Point Claude Code at these docs to generate and debug checkout-session and > webhook code against the public API. ## 1. Connect the Pocketsflow MCP server The [Pocketsflow MCP server](/api-reference/mcp-server) exposes the full public API as [Model Context Protocol](https://modelcontextprotocol.io) tools. Add it with the Claude Code CLI: ```bash theme={"system"} claude mcp add --transport http pocketsflow https://www.pocketsflow.com/mcp ``` Then sign in once: **1. Open the MCP menu** Start `claude` in your project and run `/mcp`. **2. Authenticate** Pick **pocketsflow** and choose **Authenticate**. Your browser opens Pocketsflow. **3. Allow access** Sign in if asked and click **Allow access**. Back in Claude Code, the Pocketsflow tools are ready. Pocketsflow creates a dedicated `MCP: …` API key for the connection, in the mode your account is in (connect while in test mode to build against sandbox data). Delete it under **Developers → API keys** to disconnect. Now ask things like: * *"List my last 10 orders and their totals."* * *"Create a \$29 product called Starter Kit and give me the checkout link."* * *"Which subscriptions went past due this week?"* * *"Reset the downloads on order `ord_123` and tell the customer."* Every tool call runs **as your account**. See [MCP server](/api-reference/mcp-server) for the full tool list and transport details. ### Alternative: API key (headless / CI) For non-interactive runs (CI, scripts, `claude -p` on a server) where nobody can click **Allow access**, create a key under **Developers → API keys** and pass it as a header instead: ```bash theme={"system"} claude mcp add --transport http pocketsflow https://www.pocketsflow.com/mcp \ --header "Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" ``` > [!WARNING] > > Treat API keys like passwords. A `pk_live_…` key lets the agent create and > delete **real** data. Develop with `pk_test_…`, and use a dedicated, revocable > key per integration. ## 2. Give Claude Code project context Create a `CLAUDE.md` at the root of your integration project so Claude Code follows Pocketsflow conventions when writing code: ```markdown theme={"system"} # Pocketsflow integration project ## What we're building A server-side integration with the Pocketsflow API: create checkout sessions, redirect buyers, and settle orders from signed webhooks. ## Facts the agent must respect - Base URL: https://api.pocketsflow.com - Auth: `Authorization: Bearer `. Keys are `pk_live_…` / `pk_test_…`. - Never put API keys or webhook signing secrets in client-side code. - Create checkout: `POST /checkout/sessions` → returns `{ id, url }`. Redirect the buyer to `url`. - Pass our own order id in `metadata`; it is echoed back on the order and every related webhook so we can reconcile. - Confirm payment from the `order.completed` webhook — verify the HMAC-SHA256 signature over the RAW body before trusting it. Make handlers idempotent. ## Conventions - Use `pk_test_…` in development; read keys/secrets from environment variables. - Prefer the patterns in the Pocketsflow docs (Integrations → Custom platforms). ## Do not - Log secrets or full card data. - Re-serialize the webhook body before verifying the signature. - Mark an order paid without a verified webhook. ``` ## 3. Use the docs as a source Claude Code works best when it can read the authoritative reference. Point it at: * **This documentation** — especially [Integrations overview](/integrations/overview), [Custom platforms](/integrations/custom-platforms), and [Consuming webhooks](/api-webhooks/consuming-webhooks). * The **interactive API reference** at `https://api.pocketsflow.com/docs` (OpenAPI JSON at `/docs.json`). > [!TIP] > > Every page in these docs has a **Copy / view as Markdown** and **Open in > Claude** option in the top-right menu — hand a page straight to the agent as > context instead of pasting URLs. ## Example: scaffold a webhook handler Ask Claude Code: > Using the Pocketsflow docs, write an Express endpoint that verifies the > `X-Pocketsflow-Signature` header against the raw body, handles > `order.completed` idempotently, and reads `metadata.external_order_id`. It can generate the handler, wire up the signature check, and — with the MCP server connected — send a test event to exercise it end to end. ## Related topics * [MCP setup guide](/ai-tools/mcp) * [MCP server](/api-reference/mcp-server) * [Integrations overview](/integrations/overview) * [Custom platforms](/integrations/custom-platforms) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Cursor + Pocketsflow](/ai-tools/cursor) · [Windsurf + Pocketsflow](/ai-tools/windsurf) # Cursor + Pocketsflow Source: https://docs.pocketsflow.com/ai-tools/cursor Connect Cursor to the Pocketsflow MCP server and docs so it can build and debug integrations against the Pocketsflow API. [Cursor](https://cursor.com) is an AI-native code editor. Connect it to the Pocketsflow **MCP server** and it can call the API as your account while you build; add a project rule so it writes integration code the right way. > [!NOTE] > > **Prerequisites** > > * Cursor installed. > * A Pocketsflow account. No API key needed: you approve Cursor with your > Pocketsflow login. ## Connect the Pocketsflow MCP server Add the [Pocketsflow MCP server](/api-reference/mcp-server) to Cursor's MCP config at `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (per project): ```json theme={"system"} { "mcpServers": { "pocketsflow": { "url": "https://www.pocketsflow.com/mcp" } } } ``` Reload Cursor (or toggle the server in **Settings → MCP**). When Cursor connects, your browser opens Pocketsflow: sign in and click **Allow access**. Pocketsflow creates a dedicated `MCP: …` API key for the connection; delete it under **Developers → API keys** to disconnect. Connect while your account is in test mode to keep the agent on sandbox data while you build. In Composer/Chat (Agent mode), Cursor lists the Pocketsflow tools and can run them — *"list my products"*, *"create a checkout link for product X"*, *"show orders from the last 7 days"*. Each call runs as your account. ### Alternative: API key (headless / CI) To skip the sign-in (for example in a headless or CI setup), create a key under **Developers → API keys** and send it as a header: ```json theme={"system"} { "mcpServers": { "pocketsflow": { "url": "https://www.pocketsflow.com/mcp", "headers": { "Authorization": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` > [!WARNING] > > With the header variant, keep `mcp.json` out of version control — it > contains your API key. Prefer a `pk_test_…` key, and never commit > `pk_live_…` keys. ## Add a project rule Create a Cursor project rule so the editor follows Pocketsflow conventions when generating code. In your integration repo: ```bash theme={"system"} mkdir -p .cursor/rules ``` Create `.cursor/rules/pocketsflow.mdc`: ```markdown theme={"system"} --- description: Building against the Pocketsflow API alwaysApply: true --- # Pocketsflow integration rules - Base URL: https://api.pocketsflow.com - Auth header: `Authorization: Bearer ` (`pk_live_…` / `pk_test_…`). - Secrets (API keys, webhook signing secrets) live in env vars — never in client-side code or the repo. ## Checkout - Create a session with `POST /checkout/sessions` → `{ id, url }`. - Redirect the buyer to `url`. - Put our own order id in `metadata`; it is echoed back on the order and every related webhook — use it to reconcile. ## Webhooks - Confirm payment from `order.completed`. Verify the `X-Pocketsflow-Signature` HMAC-SHA256 over the RAW request body before trusting the payload. - Make handlers idempotent (an event may be re-sent). - Return 2xx quickly; do heavy work asynchronously. ## References - Docs: Integrations → Custom platforms, and API & Webhooks → Consuming webhooks. - Interactive API reference: https://api.pocketsflow.com/docs ``` > [!TIP] > > Add `https://api.pocketsflow.com/docs.json` (the OpenAPI spec) to Cursor's > **Docs** so it can search endpoint definitions while it codes. You can also > use the **Open in Cursor** / **Copy as Markdown** action in the top-right of > any docs page to hand a page in as context. ## Typical workflow **1. Describe the integration** In Agent mode, ask Cursor to build the checkout + webhook flow, referencing the rule and docs. **2. Let it call the API via MCP** Have it create a test product and a checkout session in test mode to validate the request shape. **3. Test the webhook** Ask it to send a test event and confirm your handler verifies the signature and settles the order. ## Related topics * [MCP setup guide](/ai-tools/mcp) * [MCP server](/api-reference/mcp-server) * [Integrations overview](/integrations/overview) * [Custom platforms](/integrations/custom-platforms) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Claude Code + Pocketsflow](/ai-tools/claude-code) · [Windsurf + Pocketsflow](/ai-tools/windsurf) # MCP setup guide Source: https://docs.pocketsflow.com/ai-tools/mcp Connect any AI app or LLM provider (Claude, ChatGPT, Cursor, VS Code, Gemini CLI, Windsurf, your own agent) to the Pocketsflow MCP server — auth, first tool call, and what to try next. Connect any [Model Context Protocol](https://modelcontextprotocol.io) client to your Pocketsflow account. The hosted server at `https://www.pocketsflow.com/mcp` exposes the full public API as tools — create products, read orders, set refund policies, manage webhooks, send newsletters, and more — scoped to your account. It works with any AI app or model provider that speaks MCP, not one vendor. > [card] Endpoint > > `https://www.pocketsflow.com/mcp` — Streamable HTTP. Add the URL, then sign > in to Pocketsflow and click **Allow access**. No API key needed. This page is the **copy-paste setup guide**. For the full tool list and how the server works, see [MCP server](/api-reference/mcp-server). For editor-specific workflows (project rules, scaffolding), see [Claude Code](/ai-tools/claude-code), [Cursor](/ai-tools/cursor), and [Windsurf](/ai-tools/windsurf). ## 1. How signing in works Most MCP clients support MCP authorization (OAuth): Claude, ChatGPT, Cursor, VS Code, Gemini CLI, Windsurf, and agents built on the official MCP SDKs. With them you only add the server URL: 1. Add `https://www.pocketsflow.com/mcp` to your app (step 2 below). Leave any token or header fields empty. 2. When you connect, your browser opens Pocketsflow. Sign in if asked and check which app is asking. 3. Click **Allow access**. You're sent back to the app and the tools appear. Pocketsflow creates a dedicated API key named `MCP: ` for that connection, in the mode your account is in (live or test), and the app only ever receives short-lived tokens that refresh on their own. Delete that key under **Developers → API keys** to disconnect it. Nothing is tied to one AI vendor. Pocketsflow accepts every standard way an MCP client identifies itself: dynamic client registration, Client ID Metadata Documents, web redirects, loopback redirects on any port (CLIs), and app schemes such as `cursor://` or `vscode://` (desktop apps). ### Alternative: API key (headless / CI) For scripts, CI jobs, the `@pocketsflow/mcp` stdio bridge, or a client that can only send a static header, create a key yourself and skip the sign-in. These are the same **API keys** the REST API uses. 1. Open the dashboard → **Developers → API keys**. 2. Create a key. Prefer **`pk_test_…`** while you set things up. 3. Copy the key once — it is shown only at creation. | Prefix | Mode | Use | | - | - | - | | `pk_test_…` | Test | Sandbox data. No real money. Start here. | | `pk_live_…` | Live | Real products, customers, and payments. | Send it on every request: ``` Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx ``` > [!WARNING] > > Treat API keys like passwords. An agent with a `pk_live_…` key can create and > delete real data. Use a dedicated, revocable key per client, keep configs out > of git, and rotate if a key leaks. ## 2. Add the server to your client Pick your client. The server URL is all you need: connect, sign in, and click **Allow access**. The API-key variants are only for headless setups or clients without OAuth. > [tab] Claude > > Claude's hosted custom connectors use OAuth. You only paste the server URL, > then approve the connection with your Pocketsflow login. No API key to > create or copy. > > 1. Open **Customize → Connectors**. > 2. Click **+ → Add custom connector**. > 3. Name it **Pocketsflow** and enter > `https://www.pocketsflow.com/mcp` as the remote MCP server URL. > 4. Leave **Advanced settings** empty and click **Add**. > 5. Click **Connect**. Pocketsflow opens in your browser: sign in if asked, > check that **Claude** is the app asking, and click **Allow access**. > > Pocketsflow creates a dedicated API key named `MCP: Claude` for the > connection. Delete it under **Developers → API keys** to disconnect. > Claude discovers the OAuth endpoints automatically, so there is no URL key > or custom-header field to fill in. > > After connecting, enable **Pocketsflow** from the **+ → Connectors** menu in > a new chat and ask Claude to list your products. > [tab] Claude Desktop > > The simplest route is a custom connector: follow the **Claude** tab. A > connector you add to your Claude account is available in Claude Desktop > too, and you approve it the same way (sign in, click **Allow access**). > > **Using the local config file instead?** Claude Desktop's > `claude_desktop_config.json` only launches **stdio** servers. Bridge the > hosted HTTP endpoint with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) > (requires [Node.js](https://nodejs.org) 18+), which runs the same > Pocketsflow sign-in in your browser the first time it connects. > > 1. Open **Settings → Developer → Edit Config** (creates > `claude_desktop_config.json` if needed). > 2. Merge the block below into `mcpServers`. > 3. **Quit Claude Desktop completely** and relaunch. When your browser opens > Pocketsflow, sign in and click **Allow access**. > > **Config paths** > > | OS | Path | > | - | - | > | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` | > | Windows | `%APPDATA%\Claude\claude_desktop_config.json` | > | Linux | `~/.config/Claude/claude_desktop_config.json` | > > ```json theme={"system"} > { > "mcpServers": { > "pocketsflow": { > "command": "npx", > "args": ["-y", "mcp-remote", "https://www.pocketsflow.com/mcp"] > } > } > } > ``` > > After restart, open a new chat and confirm **pocketsflow** tools appear > under the hammer / tools menu. > > **Headless / API key variant.** To skip the sign-in, pass a key as a > header: > > ```json theme={"system"} > { > "mcpServers": { > "pocketsflow": { > "command": "npx", > "args": [ > "-y", > "mcp-remote", > "https://www.pocketsflow.com/mcp", > "--header", > "Authorization:${AUTH_HEADER}" > ], > "env": { > "AUTH_HEADER": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" > } > } > } > } > ``` > > > [!NOTE] > > > > Put the Bearer value in `env`, not inline in `args`. Claude Desktop does > > not escape spaces in args reliably (especially on Windows) — the > > `Authorization:${AUTH_HEADER}` form avoids that. > > > [!TIP] > > > > Prefer the terminal? [Claude Code](/ai-tools/claude-code) supports remote > > HTTP natively: > > > > ```bash theme={"system"} > > claude mcp add --transport http pocketsflow https://www.pocketsflow.com/mcp > > ``` > > > > Then run `/mcp` inside Claude Code, pick **pocketsflow**, and choose > > **Authenticate**. > [tab] Cursor > > Add the server to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` > (per project). With just the URL, Cursor runs the sign-in for you: when it > connects, sign in to Pocketsflow and click **Allow access**. > > ```json theme={"system"} > { > "mcpServers": { > "pocketsflow": { > "url": "https://www.pocketsflow.com/mcp" > } > } > } > ``` > > **Headless / API key variant.** To skip the sign-in, add a key as a > header: > > ```json theme={"system"} > { > "mcpServers": { > "pocketsflow": { > "url": "https://www.pocketsflow.com/mcp", > "headers": { > "Authorization": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" > } > } > } > } > ``` > > Reload Cursor (or toggle the server in **Settings → MCP**). In **Agent** > mode, Composer lists the Pocketsflow tools automatically. > > > [!WARNING] > > > > If you use the header variant, keep `mcp.json` out of version control — > > it contains your API key. > > Deeper Cursor workflow (project rules, OpenAPI docs index): > [Cursor + Pocketsflow](/ai-tools/cursor). > [tab] ChatGPT > > ChatGPT connects to **remote HTTPS** MCP servers only (no local stdio). > Custom connectors need **Developer Mode** on a paid plan (Plus, Pro, Team, > Enterprise, or Edu). > > **1. Enable Developer Mode** > > In ChatGPT, open **Settings → Apps & Connectors → Advanced settings** > (wording may be under **Security and login** on some builds) and turn > **Developer Mode** on. > > **2. Create a connector** > > Go to **Settings → Apps & Connectors** (or > [chatgpt.com/connectors](https://chatgpt.com/connectors)) → **Create** / > **Add custom connector**. Fill in: > > | Field | Value | > | - | - | > | Name | `Pocketsflow` | > | Description | Operate my Pocketsflow store via MCP | > | Connector URL | `https://www.pocketsflow.com/mcp` | > | Authentication | **OAuth** | > > Save, then sign in to Pocketsflow in the window that opens and click > **Allow access**. No API key needed. (No OAuth option on your plan? > Choose **Token** and paste a `pk_test_…` key instead.) > > **3. Use it in a chat** > > Start a new conversation → **+** → enable the **Pocketsflow** app / > Developer Mode tools → ask something read-only first (see below). > > > [!NOTE] > > > > With Token auth, if the UI asks for a custom header instead of a Token > > field, set `Authorization` to `Bearer pk_test_…` (including the > > `Bearer ` prefix). > > Workspace admins on Business/Enterprise may need to allow custom > > connectors first. ## 3. First tool call walkthrough Once the client shows Pocketsflow tools, verify the connection with a **read-only** call before anything that writes. **1. Confirm the account** Ask: > Using the Pocketsflow tools, call `get_account` and summarize who I'm > authenticated as. You should see your store / account details. A 401 or authentication error means the connection isn't signed in: reconnect from the client and click **Allow access** again. With an API key, check that the header is present, typed correctly, and the key wasn't revoked, then reload the client. **2. List products** Ask: > List my products with `list_products`. Empty is fine in a fresh test account — a successful empty list still proves auth and tool discovery work. (`list_products` takes no filters today.) **3. Create something in test mode** In test mode (your account was in test mode when you clicked **Allow access**, or you use a `pk_test_…` key): > Create a \$19 product called "MCP Starter Kit" and give me a checkout link. The agent should call `create_product` then `create_checkout_session` and return a hosted checkout URL. Open it to confirm the sandbox product. ### Handy prompts | Goal | Say | | - | - | | Recent sales | *"List my last 10 orders and their totals."* | | Subscriptions | *"Which subscribers are past due?"* | | Discount | *"Create a 20% off code LAUNCH that expires in 7 days."* | | Order lookup | *"Show order `ord_…` and why its payment failed."* | | Webhook check | *"List my webhooks and send a test event to the first one."* | | Newsletter | *"Draft a post announcing the new product — don't send yet."* | > [!TIP] > > Destructive or expensive actions (cancellations, deletes, live sends) deserve an > explicit confirmation in the chat. Stay in test mode until the flow is > trusted. ## 4. Verify without an AI client You can hit the same endpoint with `curl` to isolate client vs. server issues. `curl` can't run the browser sign-in, so this uses an API key: ```bash theme={"system"} curl https://www.pocketsflow.com/mcp \ -H "Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "get_account", "arguments": {} } }' ``` A JSON result with account fields means the key and endpoint are healthy — if the AI client still fails, re-check its config and reload. ## Troubleshooting | Symptom | Likely fix | | - | - | | Tools never appear | Reload / fully quit the client; confirm JSON is valid; for Claude Desktop ensure Node/`npx` is on `PATH`. | | `401` / "API key" | Signed-in connection: reconnect from the client (Claude Code: `/mcp` → **Authenticate**) and click **Allow access**. Deleting the app's `MCP: …` key also disconnects it. API key: missing `Bearer ` prefix, wrong env var, or revoked key. | | Browser never opens to sign in | The client doesn't support MCP OAuth. Use the API-key header variant for that client. | | "The authorization request expired" | Sign-in links last 30 minutes. Start the connection again from your AI app. | | ChatGPT can't reach the server | Must be public HTTPS — `https://www.pocketsflow.com/mcp` already is. Localhost URLs will not work. | | Writes affect live data | Your account was in live mode when you clicked **Allow access**: delete the `MCP: …` key, switch to test mode, and connect again. With a key, switch the config to `pk_test_…` and reload. | | Claude Desktop drops the server | Config only accepts stdio — use the `mcp-remote` block above, not a bare `url` field. | ## Related topics * [MCP server](/api-reference/mcp-server) — tool catalog and transport details * [Authentication & security](/api-webhooks/authentication-and-security) * [Developer setup](/development) * [Claude Code + Pocketsflow](/ai-tools/claude-code) * [Cursor + Pocketsflow](/ai-tools/cursor) * [Windsurf + Pocketsflow](/ai-tools/windsurf) # Windsurf + Pocketsflow Source: https://docs.pocketsflow.com/ai-tools/windsurf Connect Windsurf's Cascade agent to the Pocketsflow MCP server and docs to build integrations against the Pocketsflow API. [Windsurf](https://windsurf.com) is an AI-native editor whose **Cascade** agent can call tools and edit code. Connect it to the Pocketsflow **MCP server** so Cascade can act on your account, and add a workspace rule so it writes integration code correctly. > [!NOTE] > > **Prerequisites** > > * Windsurf installed. > * A Pocketsflow account. No API key needed: you approve Windsurf with your > Pocketsflow login. ## Connect the Pocketsflow MCP server Add the [Pocketsflow MCP server](/api-reference/mcp-server) to Windsurf's MCP config (Cascade → **MCP servers** → *Configure*, which edits `~/.codeium/windsurf/mcp_config.json`): ```json theme={"system"} { "mcpServers": { "pocketsflow": { "serverUrl": "https://www.pocketsflow.com/mcp" } } } ``` Refresh the server list in Cascade. When Windsurf connects, your browser opens Pocketsflow: sign in and click **Allow access**. Pocketsflow creates a dedicated `MCP: …` API key for the connection; delete it under **Developers → API keys** to disconnect. Connect while your account is in test mode to keep Cascade on sandbox data while you build. Cascade can now run Pocketsflow tools — *"list my last 10 orders"*, *"create a \$29 product and give me the checkout link"*, *"cancel subscription sub\_123"*. Each call runs as your account. ### Alternative: API key (headless / CI) To skip the sign-in, create a key under **Developers → API keys** and send it as a header: ```json theme={"system"} { "mcpServers": { "pocketsflow": { "serverUrl": "https://www.pocketsflow.com/mcp", "headers": { "Authorization": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` > [!WARNING] > > With the header variant, the MCP config holds your API key — keep it out of > shared repos. Prefer a `pk_test_…` key while developing, and never expose > `pk_live_…` keys. ## Add a workspace rule Give Cascade project context and standards. Create `.windsurf/rules/pocketsflow.md` in your workspace root: ```markdown theme={"system"} # Pocketsflow integration rules ## Project Server-side integration with the Pocketsflow API: create checkout sessions, redirect buyers, and settle orders from signed webhooks. ## Facts - Base URL: https://api.pocketsflow.com - Auth: `Authorization: Bearer ` (`pk_live_…` / `pk_test_…`). - Keep API keys and webhook signing secrets in env vars, never client-side. ## Checkout - `POST /checkout/sessions` returns `{ id, url }`; redirect the buyer to `url`. - Put our own order id in `metadata`; it is echoed back on the order and related webhooks for reconciliation. ## Webhooks - Verify the `X-Pocketsflow-Signature` HMAC-SHA256 over the RAW body. - Confirm payment from `order.completed`; make handlers idempotent. ## References - Docs: Integrations → Custom platforms; API & Webhooks → Consuming webhooks. - Interactive API reference: https://api.pocketsflow.com/docs ``` > [!TIP] > > Use the **Copy as Markdown** / open-in-editor action in the top-right of any > docs page to paste an authoritative reference straight into Cascade as > context. ## Typical workflow **1. Plan with Cascade** Ask Cascade to design the checkout + webhook flow using the workspace rule and docs. **2. Validate via MCP** Have it create a test product and checkout session in test mode. **3. Exercise the webhook** Send a test event and confirm the handler verifies the signature and settles the order idempotently. ## Related topics * [MCP setup guide](/ai-tools/mcp) * [MCP server](/api-reference/mcp-server) * [Integrations overview](/integrations/overview) * [Custom platforms](/integrations/custom-platforms) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Claude Code + Pocketsflow](/ai-tools/claude-code) · [Cursor + Pocketsflow](/ai-tools/cursor) # A/B tests Source: https://docs.pocketsflow.com/api-reference/ab-tests Start price, headline, cover, checkout and subscription-offer tests, read live results (MRR and retention for subscriptions) and keep the winner — from the API, the SDK or an AI agent. Starting a test needs the **Pro** plan: below it, `POST /ab-tests` answers `403` with `code: FEATURE_LOCKED` and `details.feature: "abTests"`. Reading, stopping, declaring a winner and deleting are never gated. Every route works in the API key's mode (live or test). ## Start a test `variants` are the challengers (B, C, D). Variant A is the product as it is now and is added for you. ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/ab-tests \ -H "Authorization: Bearer pk_live_…" \ -H "Content-Type: application/json" \ -d '{ "productId": "665f1c2a9b3e4a0012ab34cd", "type": "price", "variants": [{ "label": "Higher price", "price": 59 }] }' ``` | `type` | Field on each variant | | - | - | | `price` | `price` — list price in your account currency (1–1,000,000) | | `headline` | `headline`, optional `description` (HTML) | | `cover` | `coverImage` — an https URL (upload with `POST /images`) | | `checkout_layout` | `checkoutLayout` — `split`, `flipped`, `focus`, `banner`, `card`, `hero`, `sidebar`, `gallery`, `sheet` or `frame` | | `checkout_copy` | `checkoutText` — the checkout message, plain text (blank line = new paragraph), returned as escaped HTML | | `subscription_offer` | `price` (per period), `frequency` (`weekly`, `monthly`, `yearly`), `trialPeriod` (days, 0–365), `trialPrice` (0 = free trial) | ### Subscriptions Send `subscriptionId` instead of `productId` to test a subscription. A subscription can run `subscription_offer`, `checkout_layout` or `checkout_copy` tests. Each `subscription_offer` variant is a whole offer: ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/ab-tests \ -H "Authorization: Bearer pk_live_…" \ -H "Content-Type: application/json" \ -d '{ "subscriptionId": "6650aa2a9b3e4a0012ab77ef", "type": "subscription_offer", "variants": [{ "label": "Yearly + 14-day trial", "price": 190, "frequency": "yearly", "trialPeriod": 14, "trialPrice": 0 }] }' ``` The buyer is charged exactly the offer they were shown (same rule as price tests, below). Offer tests can't start while intro pricing is on, and turning intro pricing on stops a running one (`endDetail: "introPricing"`). Optional: `name`, and `weights` — the traffic split in whole percents, A first, each 5–95, adding up to 100 (default: equal). | Status | `code` | When | | - | - | - | | `201` | — | The running test | | `400` | — | Invalid body, a variant equal to A, a pay-what-you-want or variant product in a price test, a type the item can't run, intro pricing on during an offer test | | `403` | `FEATURE_LOCKED` | Your plan is below Pro | | `409` | `AB_TEST_RUNNING` | The product or subscription already has a running test | ## Routes | Method | Path | What it does | | - | - | - | | `GET` | `/ab-tests` | Your tests, newest first, with `summary: { visitors, conversions }` (`status`, `productId` / `subscriptionId` filters) | | `POST` | `/ab-tests` | Start a test | | `GET` | `/ab-tests/{id}` | The test with its live `results` (`timezoneOffsetMinutes` for local days) | | `GET` | `/ab-tests/{id}/results` | The `results` alone | | `POST` | `/ab-tests/{id}/stop` | End it without a winner (`409 AB_TEST_NOT_RUNNING` when already ended) | | `POST` | `/ab-tests/{id}/winner` | `{ "variantId" }` — end it and apply the winner to the product or subscription | | `DELETE` | `/ab-tests/{id}` | Delete an ended test (`409 AB_TEST_RUNNING` while running) | | `POST` | `/ab-tests/public/assign` | PUBLIC — the storefront's lookup of one visitor's variant | ## Results ```json theme={"system"} { "currency": "USD", "metric": "revenue_per_visitor", "totals": { "visitors": 6872, "conversions": 225, "revenue": 11742 }, "variants": [ { "key": "A", "control": true, "visitors": 3412, "conversions": 116, "conversionRate": 3.4, "revenuePerVisitor": 1.67, "verdict": "control" }, { "key": "B", "control": false, "visitors": 3388, "conversions": 109, "conversionRate": 3.22, "revenuePerVisitor": 1.9, "lift": -5.3, "pValue": 0.6744, "probabilityToBeat": 0.3372, "revenueProbabilityToBeat": 0.9712, "probabilityToBeBest": 0.97, "significant": true, "verdict": "winning" } ], "daily": [{ "date": "2026-10-03", "variants": { "": { "visitors": 210, "conversions": 6 } } }], "recommendation": { "variantId": "", "reason": "winner" }, "thresholds": { "minVisitors": 100, "minConversions": 10 } } ``` * `pValue` — two-proportion z-test of the conversion rate against A (two-sided). Under 0.05 = 95% confident they differ. * `probabilityToBeat` — Bayesian chance (flat prior, exact) the variant's conversion rate is higher than A's. * `revenueProbabilityToBeat` — price tests: chance the variant earns more per visitor. Price tests are judged on this (`metric: "revenue_per_visitor"`). * `verdict` — `collecting` until both arms have 100+ visitors and 10+ conversions between them; then `winning`, `losing` or `no_difference`. * Conversions are paid, unrefunded sales credited to the variant the buyer saw; revenue is in your account currency. ### Subscription results For a subscription test (`itemKind: "subscription"`), `conversions` are new subscribers (trials included, counted when the subscription starts) and `revenue` is everything they paid so far. Each variant also has: ```json theme={"system"} "subscription": { "active": 41, "retention": 87.23, "paid": 38, "paidRate": 80.85, "mrr": 1176.5, "mrrPerVisitor": 0.34 } ``` * `retention` — percent of the variant's subscribers still active or in trial. * `paidRate` — percent who paid at least one full period (trial → paid). * `mrr` — monthly recurring revenue of active paying subscribers: each one's latest full-period payment, normalised to a month by the variant's interval. * `subscription_offer` tests are judged on MRR per visitor (`metric: "mrr_per_visitor"`), so a cheaper plan or a longer trial only wins if it really brings in more recurring revenue. Until somebody has paid a full period, the verdict follows the conversion rate. ## Visitor assignment `POST /ab-tests/public/assign` with `{ productId, visitorId, currency? }` (or `subscriptionId` for a subscription) returns `{ test: { testId, variantId, type, basePrice, overrides } }` or `{ test: null }`. `visitorId` is the visitor's own random id (16–64 characters of `A-Z a-z 0-9 _ -`); the same id always gets the same variant, and the first call logs the visit. Bots get `null`. With `currency`, a price variant also comes back as `displayPrice`, converted exactly as checkout will charge it. The hosted product page and checkout send the same id as `abVisitor`, and the variant they actually rendered as `abVariant`, when they create the checkout session. The server charges the variant only when `abVariant` matches its own record of the visitor; otherwise (no claim, `""`, or another id — the page could not load the variant) it charges the product's own price and the sale is not credited to the test. A price never comes from the page. `GET /pricing/quote/{productId}` and `GET /personal-deadlines/public/offer` take the same pair as `vid` + `abv`. The hosted subscription checkout sends `abVisitor` + `abVariant` too: a matching `subscription_offer` variant sets the price per period, the interval and the trial; anything else charges the subscription's own offer. ## Webhook `ab_test.completed` fires when a test ends — a winner was declared, it was stopped, or a conflicting product edit stopped it — with every variant's results. See [Webhook events](/api-webhooks/events#ab-test-completed). ## MCP tools `list_ab_tests`, `create_ab_test`, `get_ab_test`, `get_ab_test_results`, `stop_ab_test`, `declare_ab_test_winner`, `delete_ab_test`. # Analytics API Source: https://docs.pocketsflow.com/api-reference/analytics Read the sales funnel, revenue by source and UTM, repeat-buyer cohorts, net revenue after refunds and MRR with an API key. Every report in [Advanced analytics](/operations/advanced-analytics) (Growth) and [MRR reports](/operations/mrr-reports) (Pro) is a `GET` with your API key. A `pk_test_` key reads test-mode data, a `pk_live_` key live data. Money is a decimal amount in your account currency (`currency` in every response). | Method | Endpoint | Plan | Operation ID | | - | - | - | - | | `GET` | `/analytics/preview` | every plan | `getAnalyticsPreview` | | `GET` | `/analytics/advanced/summary` | Growth | `getAnalyticsSummary` | | `GET` | `/analytics/advanced/funnel` | Growth | `getSalesFunnel` | | `GET` | `/analytics/advanced/sources` | Growth | `getRevenueBySource` | | `GET` | `/analytics/advanced/cohorts` | Growth | `getRepeatBuyerCohorts` | | `GET` | `/analytics/advanced/net-revenue` | Growth | `getNetRevenue` | | `GET` | `/analytics/mrr` | Pro | `getMrr` | ## Range parameters | Parameter | Default | Notes | | - | - | - | | `from` | 30 days before `to` | ISO date-time. | | `to` | now | ISO date-time; a bare date (`2026-09-30`) covers the whole day. At most 732 days after `from`. | | `timezoneOffsetMinutes` | `0` | `new Date().getTimezoneOffset()` — days and months follow your local time. MRR days are always UTC. | Every response carries `range.previous`: the window of the same length right before `from`, which the comparison numbers use. ## Examples ```bash theme={"system"} # The funnel for September, with the previous 30 days for comparison curl "https://api.pocketsflow.com/analytics/advanced/funnel?from=2026-09-01&to=2026-09-30" \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" # Net revenue by UTM campaign curl "https://api.pocketsflow.com/analytics/advanced/sources?dimension=utm_campaign" \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" # MRR for one subscription offer over the last 90 days curl "https://api.pocketsflow.com/analytics/mrr?from=2026-07-18&subscriptionId=665f1c2a9b3e4a0012ab34cd" \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` ```json title="GET /analytics/mrr (abridged)" theme={"system"} { "currency": "USD", "range": { "from": "2026-09-17", "to": "2026-10-16", "days": 30, "previous": { "from": "2026-08-18", "to": "2026-09-16" } }, "hasTrials": true, "summary": { "mrr": 4820, "arr": 57840, "subscribers": 241, "newMrr": 610, "expansionMrr": 120, "contractionMrr": 40, "churnedMrr": 310, "netMrrMovement": 380, "logoChurnRate": 4.1, "revenueChurnRate": 7.7, "monthlyChurnRate": 4.1, "arpu": 20, "ltv": 487.8, "trials": { "started": 52, "ended": 47, "converted": 21, "conversionRate": 44.7, "trialing": 18 } }, "previous": { "mrr": 4440 }, "series": [{ "day": "2026-09-17", "mrr": 4440, "newMrr": 20, "churnedMrr": 0, "netMrr": 20 }], "products": [{ "subscriptionId": "665f…", "name": "Pro Club", "mrr": 3100, "subscribers": 155 }] } ``` ## Plan gating Below the plan a report needs, it answers `403` with `code: FEATURE_LOCKED` and `details.feature` (`advancedAnalytics` or `mrrReports`), `details.requiredPlan` and `details.requiredPlanName`. `GET /analytics/preview` (headline totals) works on every plan. ## MCP tools `get_analytics_preview`, `get_analytics_summary`, `get_sales_funnel`, `get_revenue_by_source`, `get_repeat_buyer_cohorts`, `get_net_revenue` and `get_mrr` call these endpoints. See [MCP server](/api-reference/mcp-server). # Attribution survey Source: https://docs.pocketsflow.com/api-reference/attribution-survey Set the "How did you hear about us?" question and read answers and revenue per channel with your API key or from an AI agent over MCP. One question on the thank-you page, with your answers and an optional "Other" text field. Each answer is saved on the order, so the report shows answers and revenue per channel next to your tracked links' sales. Product guide: [Attribution survey](/selling/attribution-survey). > [!NOTE] > > Growth plan and above. Saving with `enabled: true` answers `403` with > `code: FEATURE_LOCKED` on a plan without the survey. Reading the report, > editing the words and switching it off stay open. ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/attribution-survey/settings` | `getAttributionSurvey` | `get_attribution_survey` | | `PUT` | `/attribution-survey/settings` | `updateAttributionSurvey` | `update_attribution_survey` | | `GET` | `/attribution-survey/report` | `getAttributionReport` | `get_attribution_report` | ## Set the question ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/attribution-survey/settings \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "question": "How did you hear about us?", "options": [ { "id": "instagram", "label": "Instagram", "channel": "instagram" }, { "label": "My podcast" }, { "label": "A friend" } ], "allowOther": true }' ``` * 2 to 12 options, labels up to 60 characters, question up to 120. * Send an option's `id` to keep its past answers after a rename; new options get an id from their label. `other` is reserved for the free-text answer. * `channel` (optional) is a tracked-link channel: `instagram`, `tiktok`, `youtube`, `x`, `facebook`, `email`, `ads` or `other`. ## Read the report `GET /attribution-survey/report?startDate=…&endDate=…` (ISO dates, 30 days by default, 366 at most) returns: | Field | Meaning | | - | - | | `totals.shown` | Paid orders whose buyer saw the question | | `totals.answered` | How many answered | | `totals.responseRate` | Percent who answered | | `totals.revenue` | What answered orders paid, account currency | | `options[]` | `id`, `label`, `channel`, `answers`, `share` (% of answers), `revenue` | | `other` | `answers`, `share`, `revenue` and the 10 most common `topAnswers` | | `trackedLinks.channels[]` | Your tracked links' `clicks`, `visitors`, `sales` and `revenue` per channel over the same dates (`locked: true` when your plan has no tracked-link stats) | Refunded and test orders are left out (the key's mode decides which). # Payment plans and exit offers Source: https://docs.pocketsflow.com/api-reference/checkout-offers Configure a product’s payment plan, exit discount and downsell with your API key, and read what a checkout offers. Base URL `https://api.pocketsflow.com`. Authenticate with your API key (`Authorization: Bearer pk_live_…` or `pk_test_…`). Turning a feature **on** needs the Growth plan; turning it off never does. ## Read the settings `GET /products/{id}/checkout-offers` ```json theme={"system"} { "paymentPlan": { "enabled": true, "installments": 3, "surchargePercent": 0 }, "exitOffer": { "enabled": true, "valueType": "percentage", "value": 10, "discountId": "6710b2c49e3f1a0012cd56ef" }, "downsell": { "enabled": true, "productId": "665f1c2a9b3e4a0012ab34ce", "price": 19 } } ``` ## Payment plan `PATCH /products/{id}/payment-plan` — partial: fields you leave out keep their value. | Field | Type | Notes | | - | - | - | | `enabled` | boolean | Offer “Pay in N” on the checkout. Needs a fixed price. | | `installments` | integer | 2 to 6. Default 3. Payments are 30 days apart. | | `surchargePercent` | number | Optional fee on the whole price, 0 to 25 (two decimals). | ```bash theme={"system"} curl -X PATCH https://api.pocketsflow.com/products/665f1c2a9b3e4a0012ab34cd/payment-plan \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "installments": 3 }' ``` Response: `{ "paymentPlan": { "enabled": true, "installments": 3, "surchargePercent": 0 } }`. ## Exit offer and downsell `PATCH /products/{id}/exit-offer` — send `exitOffer`, `downsell` or both. | Field | Type | Notes | | - | - | - | | `exitOffer.enabled` | boolean | Show the one-time exit discount. | | `exitOffer.valueType` | `percentage` \| `fixed` | | | `exitOffer.value` | number | Whole percent 1–90, or an amount in your currency. | | `downsell.enabled` | boolean | Offer a cheaper product when a buyer removes an order bump. | | `downsell.productId` | string | Another of your products, same mode. | | `downsell.price` | number | Its price on this offer; `0` uses the product's own price. | Turning the exit offer on creates a discount with its own code (returned as `exitOffer.discountId`); it stays in step with the amount you set. ## Errors | Status | When | | - | - | | `400` | Invalid settings, e.g. `Choose between 2 and 6 payments.` | | `403` | `code: FEATURE_LOCKED` — turning it on needs the Growth plan (`details.requiredPlan`). | | `404` | No product with this id in your account (current mode). | ## What a checkout offers (public) `GET /checkout-offers/{productId}` — no API key. Returns what the product's checkout offers right now, with the seller's plan applied. An offer is `null` when it is off or the plan no longer includes it. ```json theme={"system"} { "paymentPlan": { "installments": 3, "surchargePercent": 0, "intervalDays": 30 }, "exitOffer": { "valueType": "percentage", "value": 10 }, "downsell": { "productId": "665f1c2a9b3e4a0012ab34ce", "name": "Notion OS Lite", "thumbnail": "", "price": 19 } } ``` ## Orders Every payment of a plan is an order with `installment: { "index": 2, "of": 3 }`. See the [`installment.paid`](/api-webhooks/events#installment-paid) and [`installment.failed`](/api-webhooks/events#installment-failed) webhooks. ## MCP The MCP server exposes `get_checkout_offers`, `update_payment_plan` and `update_exit_offer`. # Limited drops, PDF stamping & download limits Source: https://docs.pocketsflow.com/api-reference/delivery-protection Sell a fixed number of copies, stamp PDFs with the buyer's email and limit downloads with your API key or the MCP server. Three settings that live on a product. **Limited drops** and **PDF stamping** need the **Starter** plan (or higher) to turn on; **download limits** need **Growth**. Reading them and turning them off is never gated. A call that turns one on below its plan answers `403` with `code: "FEATURE_LOCKED"`: ```json theme={"system"} { "error": "FEATURE_LOCKED", "code": "FEATURE_LOCKED", "upgradeRequired": true, "message": "This feature is part of a higher plan. Please upgrade your plan to use it.", "details": { "feature": "downloadLimits", "requiredPlan": "tier2", "requiredPlanName": "Growth" } } ``` ## Limited drops | Method | Path | MCP tool | | - | - | - | | `GET` | `/products/{id}/limited-drop` | `get_limited_drop` | | `PATCH` | `/products/{id}/limited-drop` | `update_limited_drop` | | `GET` | `/products/{id}/drop` (public) | `get_limited_drop_availability` | ```bash theme={"system"} curl -X PATCH https://api.pocketsflow.com/products/665f1c2a9b3e4a0012ab34cd/limited-drop \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "quantity": 100, "restockOnRefund": false }' ``` ```json theme={"system"} { "limitedDrop": { "enabled": true, "quantity": 100, "restockOnRefund": false, "sold": 0, "reserved": 0, "remaining": 100, "soldOut": false, "startedAt": "2026-10-16T09:00:00.000Z" } } ``` | Field | Type | Notes | | - | - | - | | `enabled` | boolean | Needs a `quantity` (in the body or saved). | | `quantity` | integer | 1–1,000,000. Raising it reopens sales; lowering it under `sold` closes them. | | `restockOnRefund` | boolean | A refunded order's copy goes back on sale (once). | | `sold`, `reserved`, `remaining`, `soldOut` | read-only | `reserved` = copies held by buyers on the checkout right now. | How the count stays exact: * A buyer who opens the checkout **holds one copy for 15 minutes** (one per browser, so reloading or changing the order never takes a second copy). The hold is taken with a single atomic update that only succeeds while `sold + reserved < quantity`, so two buyers can never get the last copy. * When the payment goes through, the hold becomes a sold copy. A declined card keeps the hold 5 more minutes (to try another card), then it goes back. Expired holds go back within a minute. * No copy left: creating a checkout (and `POST /products/buy-free` for a free product) answers `409`: ```json theme={"system"} { "code": "SOLD_OUT", "reason": "sold_out", "message": "Sold out. Every copy of this product has been sold." } ``` `reason` is `all_reserved` while the last copies sit in other buyers' checkouts ("check back in a few minutes"). A buyer who already paid is never refused, even if their hold ran out. `GET /products/{id}/drop` needs no API key — use it to show "35 of 100 left" on your own site: ```json theme={"system"} { "enabled": true, "quantity": 100, "remaining": 35, "sold": 63, "reserved": 2, "soldOut": false } ``` If your plan no longer includes limited drops, the counter disappears and the limit stops applying (sales are never blocked); your settings and counts are kept. ## PDF stamping | Method | Path | MCP tool | | - | - | - | | `GET` | `/products/{id}/pdf-stamping` | `get_pdf_stamping` | | `PATCH` | `/products/{id}/pdf-stamping` | `update_pdf_stamping` | ```bash theme={"system"} curl -X PATCH https://api.pocketsflow.com/products/665f1c2a9b3e4a0012ab34cd/pdf-stamping \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "enabled": true }' ``` When on, every PDF of the product is stamped as the buyer downloads it: a small grey footer on each page, `Licensed to ada@example.com · Order 12CD56EF · Oct 16, 2026`, plus the same line in the file's metadata. A gift is stamped with the recipient's email. Other files are delivered untouched, and a PDF that can't be stamped (encrypted, damaged) is delivered as is. ## Download limits | Method | Path | MCP tool | | - | - | - | | `GET` | `/products/{id}/download-limits` | `get_download_limits` | | `PATCH` | `/products/{id}/download-limits` | `update_download_limits` | | `GET` | `/orders/{id}/downloads` | `get_order_downloads` | | `POST` | `/orders/{id}/downloads/reset` | `reset_order_downloads` | ```bash theme={"system"} curl -X PATCH https://api.pocketsflow.com/products/665f1c2a9b3e4a0012ab34cd/download-limits \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "maxDownloads": 5, "expiryDays": 7 }' ``` | Field | Type | Notes | | - | - | - | | `maxDownloads` | integer \| null | Downloads per file per order, 1–1000. `null` = no count limit. | | `expiryDays` | integer \| null | Days the links work after the purchase (or after you reset the buyer's downloads), 1–3650. `null` = never expire. | | `applyToExisting` | boolean | Default `false`: only orders placed after you turned the limits on are limited. | | `appliesFrom` | read-only | When the limits were last turned on. | A browser retrying the same file within 30 seconds is not charged twice, and resumed downloads never count. When a buyer runs out, their delivery page shows how to contact you; `POST /orders/{id}/downloads/reset` gives them everything back and restarts the expiry window: ```json theme={"system"} { "downloads": { "limited": true, "maxDownloads": 5, "expiresAt": "2026-10-23T09:12:00.000Z", "expired": false, "remaining": 5, "exhausted": false, "files": [{ "key": "main", "name": "Field Guide", "used": 0, "remaining": 5 }], "stamped": true, "totalDownloads": 2, "lastDownloadAt": "2026-10-16T10:02:00.000Z", "resetAt": "2026-10-16T11:00:00.000Z", "resetCount": 1 } } ``` Resetting is never gated by plan. If your plan no longer includes download limits, buyers download without limits again; your settings are kept. # REST API endpoint reference Source: https://docs.pocketsflow.com/api-reference/endpoints Every operation in the Pocketsflow public REST API contract, generated from the OpenAPI spec. This catalog lists every operation in the public OpenAPI contract: **61 paths and 85 operations**. Every endpoint requires an API key unless its description says **PUBLIC**. A few SDK helpers (for example `users.update` and `variants`) call routes that are not in the public contract yet; see the [SDK reference](/api-reference/sdk-reference). > [card] [Interactive API explorer](https://api.pocketsflow.com/docs) > > Try requests, inspect schemas, and copy generated examples in Scalar. The machine-readable contract is available at [`/docs.json`](https://api.pocketsflow.com/docs.json). This page is generated from the same public contract so the catalog does not drift from the deployed API. Every operation has a stable `operationId` you can use with OpenAPI code generators. ## Conventions * Base URL: `https://api.pocketsflow.com` * Authentication: `Authorization: Bearer pk_live_...` (live data) or `Authorization: Bearer pk_test_...` (test data). The key decides the mode, not the dashboard toggle. * JSON requests use `Content-Type: application/json`; file uploads use `multipart/form-data`. * IDs are MongoDB ObjectId strings (24 hex characters). Payments-partner IDs such as `plan_...`, `pay_...`, and `mem_...` keep their prefixes. * Money is a decimal amount in major currency units (`29.99`), not cents. * Errors are JSON: `{ "message": "..." }`, with `error` (authentication errors) and sometimes a machine-readable `code`. See [Errors](/api-reference/introduction#errors). * Every authenticated endpoint can also answer `401` (invalid key), `429` (rate limited — 600 requests/minute per account) and `500`. * `GET /orders`, `GET /payments` and `GET /delivered-webhooks` are paginated with `page` and `pageSize` (maximum 100); most other lists return everything in one response. ```bash theme={"system"} curl https://api.pocketsflow.com/users/me \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` > [!WARNING] > > Keep API keys server-side. Never put a secret key in browser code, a mobile > app, a public repository, or a URL. ## Account Read the authenticated account | Method | Endpoint | Description | | - | - | - | | `GET` | `/users/me` | Get current user information | > [accordion] GET /users/me > > Retrieve the authenticated account: ids, store name, subdomain, currency, the key's test/live mode, and whether it can sell. Use `subdomain` to build storefront and product URLs. > > Operation ID: `getCurrentUser` > > **Responses** > > | Status | Description | > | - | - | > | `200` | The account — returns `User` | > | `401` | Missing or invalid API key | > | `403` | The account is suspended | > | `404` | No account exists for these credentials | > | `410` | The account was deleted | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Checkout Create hosted checkout links for your products and offers | Method | Endpoint | Description | | - | - | - | | `POST` | `/checkout/sessions` | Create checkout session | > [accordion] POST /checkout/sessions > > Create a hosted checkout link for a one-time product OR a subscription (recurring) offer — pass either kind of id as `productId`. Redirect the buyer to the returned `url`. The link lives on your store subdomain, so your account needs a `subdomain` first (`400` otherwise). Payment methods (card, Apple Pay, Google Pay, Link, ACH, and country-specific methods such as iDEAL) are taken from the seller's account — there is no payment-method parameter on this endpoint. > > Operation ID: `createCheckoutSession` > > **Request body** > > Content type: `application/json` > Required fields: `productId`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `productId` | string | Yes | Id of the product OR subscription offer to purchase. | > | `successUrl` | string (uri) | No | Absolute http(s) URL to send the buyer to after a successful payment. Optional. | > | `cancelUrl` | string (uri) | No | Absolute http(s) URL to send the buyer to if they cancel. Optional. | > | `customerEmail` | string (email) | No | Customer email. Prefills the email on the checkout page (and inside the payment form) and is attached to the resulting order and webhook payload. | > | `lockEmail` | boolean | No | With customerEmail, makes the prefilled email read-only so the buyer can't change it. | > | `clientReferenceId` | string | No | Your own correlation id. Echoed back top-level as `clientReferenceId` on the resulting webhooks, including every subscription lifecycle event. | > | `discountCode` | string | No | Discount code to apply | > | `metadata` | object | No | Custom metadata for the checkout, echoed back on webhook payloads. For subscriptions it is captured at activation and replayed on every customer.subscription.\_ / invoice.\_ event. | > > **Responses** > > | Status | Description | > | - | - | > | `201` | Checkout session created — returns `CheckoutSession` | > | `400` | Missing `productId`, a non-http(s) `successUrl`/`cancelUrl`, invalid `metadata` / `clientReferenceId`, or no store subdomain yet | > | `401` | Missing or invalid API key | > | `404` | `productId` is not one of your products or subscription offers | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Customers Access your customer base | Method | Endpoint | Description | | - | - | - | | `GET` | `/customers` | List all customers | | `GET` | `/customers/{id}` | Get customer by ID | > [accordion] GET /customers > > Retrieve all your customers in the key's mode (deduplicated by email, each with a computed `numberOfOrders` and a `products` array of `{ _id, name }` for every product or subscription they bought). Optionally filter by product (matches any of the buyer's purchases) and sort. The full list is returned — this endpoint is not paginated. > > Operation ID: `listCustomers` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `productId` | `query` | No | string | Only customers who bought this product or subscription (any purchase, not just the first) | > | `sortBy` | `query` | No | string — email, country, numberOfOrders, createdAt; default: `createdAt` | Field to sort by | > | `sortOrder` | `query` | No | string — asc, desc; default: `desc` | Sort direction | > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of customers — returns `CustomerListItem[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /customers/\{id} > > Retrieve a customer with their stats, one-time orders, subscriptions and reviews > > Operation ID: `getCustomer` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Customer id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Customer details — returns `CustomerDetail` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Discounts Create and manage discount codes | Method | Endpoint | Description | | - | - | - | | `GET` | `/discounts` | List all discounts | | `POST` | `/discounts` | Create a discount | | `GET` | `/discounts/{id}` | Get discount by ID | | `POST` | `/discounts/{id}` | Update discount | | `DELETE` | `/discounts/{id}` | Delete discount | | `GET` | `/discounts/apply/{discountCode}/{productId}` | Validate and apply a discount code | | `GET` | `/discounts/check-product/{productId}` | Check if a product has discounts | > [accordion] GET /discounts > > Retrieve all your discount codes in the key's mode, each with `used` (number of sales that used it) > > Operation ID: `listDiscounts` > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of discounts — returns `Discount[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /discounts > > Create a new discount code. Codes are unique per account and mode (`400` if the code exists). `mainProductIds` must all be your own products or subscription offers in the key's mode. Set `expiration` to end a promotion automatically, or `active: false` to stop it now. > > Operation ID: `createDiscount` > > **Request body** > > Content type: `application/json` > Required fields: `name`, `code`, `value`, `mainProductIds`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | Yes | Discount name (non-empty) | > | `code` | string | Yes | Discount code - what customers enter at checkout | > | `value` | number | Yes | Greater than 0. Percent off (`percentage`, at most 100) or a fixed decimal amount off in your account currency (`fixed`) | > | `valueType` | string — percentage, fixed; default: `percentage` | No | Discount type (defaults to percentage) | > | `mainProductIds` | array of string | Yes | Ids of your own products / subscription offers (in the key's mode) the discount applies to. Required and non-empty on create. | > | `active` | boolean; default: `true` | No | Whether discount is active | > | `expiration` | string (date-time), nullable | No | When the code stops working (ISO 8601). `null` or empty for no expiry. | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The created discount — returns `Discount` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /discounts/\{id} > > Retrieve one of your discounts > > Operation ID: `getDiscount` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Discount id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The discount — returns `Discount` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /discounts/\{id} > > Partially update a discount — only the fields you send change. Send `expiration: null` to remove an expiry date. A new `code` must not clash with another of your discounts. > > Operation ID: `updateDiscount` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Discount id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | Discount name (non-empty) | > | `code` | string | No | Discount code - what customers enter at checkout | > | `value` | number | No | Greater than 0. Percent off (`percentage`, at most 100) or a fixed decimal amount off in your account currency (`fixed`) | > | `valueType` | string — percentage, fixed; default: `percentage` | No | Discount type (defaults to percentage) | > | `mainProductIds` | array of string | No | Ids of your own products / subscription offers (in the key's mode) the discount applies to. Required and non-empty on create. | > | `active` | boolean; default: `true` | No | Whether discount is active | > | `expiration` | string (date-time), nullable | No | When the code stops working (ISO 8601). `null` or empty for no expiry. | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated discount — returns `Discount` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /discounts/\{id} > > Delete a discount code > > Operation ID: `deleteDiscount` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Discount id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Discount deleted — returns `{ message }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /discounts/apply/\{discountCode}/\{productId} > > PUBLIC (no API key) — used by the checkout. Validates a discount code against a product and returns the discount if it exists, is active, has not expired, and applies to the product. Returns 404 otherwise. > > Operation ID: `applyDiscountCode` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `discountCode` | `path` | Yes | string | The discount code the customer entered | > | `productId` | `path` | Yes | string | Product ID to validate the code against | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The discount is valid — the discount object is returned — returns `Discount` | > | `404` | Discount not found, inactive, expired, or not applicable to this product | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /discounts/check-product/\{productId} > > PUBLIC (no API key) — used by the checkout. Returns `true` if any discount applies to the given product, `false` otherwise. > > Operation ID: `checkProductDiscounts` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `productId` | `path` | Yes | string | Product ID to check | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Boolean — whether any discount targets this product — returns `boolean` | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Images Upload images | Method | Endpoint | Description | | - | - | - | | `POST` | `/images` | Upload image | > [accordion] POST /images > > Upload an image file as multipart/form-data. The file field must be named `image`; other field names return 400. PNG, JPEG, GIF, WebP and AVIF are accepted — the type is detected from the file's bytes, not its name or declared type. > > Operation ID: `uploadImage` > > **Request body** > > Content type: `multipart/form-data` > Required fields: `image`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `image` | string (binary) | Yes | Image file to upload | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Image uploaded — returns `{ imageUrl }` | > | `400` | No file in the `image` field, an unexpected multipart field name, or an invalid multipart upload | > | `401` | Missing or invalid API key | > | `413` | File exceeds the authenticated plan's upload limit | > | `415` | The file is not a PNG, JPEG, GIF, WebP or AVIF image (checked from the file's bytes; SVG is rejected) — returns `{ message, allowedTypes: string[] }` | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Licenses License keys for software you sell. The three **PUBLIC** endpoints are called from your app with the product id and the key — no API key, 60 requests per minute per IP. The rest manage your keys with your API key. Full guide, error codes and examples: [License keys](/api-reference/license-keys). | Method | Endpoint | Description | | - | - | - | | `POST` | `/licenses/validate` | **PUBLIC** — validate a license key | | `POST` | `/licenses/activate` | **PUBLIC** — activate a key on an instance | | `POST` | `/licenses/deactivate` | **PUBLIC** — free an instance's activation | | `GET` | `/licenses` | List license keys | | `GET` | `/licenses/{id}` | Get a license key | | `POST` | `/licenses/{id}/disable` | Disable a license key | | `POST` | `/licenses/{id}/enable` | Enable a license key | | `POST` | `/licenses/{id}/reset-activations` | Reset a license key's activations | Operation IDs: `validateLicenseKey`, `activateLicenseKey`, `deactivateLicenseKey`, `listLicenseKeys`, `getLicenseKey`, `disableLicenseKey`, `enableLicenseKey`, `resetLicenseKeyActivations`. ## Link in Bio Manage your Link in Bio page (creator page): profile, links, theme and which products it shows | Method | Endpoint | Description | | - | - | - | | `GET` | `/creator-pages` | Get your Link in Bio page | | `POST` | `/creator-pages` | Create your Link in Bio page | | `PUT` | `/creator-pages` | Update your Link in Bio page | | `DELETE` | `/creator-pages` | Delete your Link in Bio page | | `PATCH` | `/creator-pages/username` | Change your Link in Bio username | | `GET` | `/creator-pages/check-username/{username}` | Check whether a username is available | > [accordion] GET /creator-pages > > Retrieve your Link in Bio page configuration and content > > Operation ID: `getCreatorPage` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Your Link in Bio page — returns `CreatorPage` | > | `401` | Missing or invalid API key | > | `404` | You have no Link in Bio page yet — create one with `POST /creator-pages`. Plain-text body. | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /creator-pages > > Create your Link in Bio page. Create-only: if you already have a page this returns `400` — update it with `PUT /creator-pages`. `username` is required and also becomes your store subdomain. Send JSON, or `multipart/form-data` to upload `profilePicture`, `coverImage` and `images` files. > > Operation ID: `createCreatorPage` > > **Request body** > > Content type: `application/json` > Required fields: `username`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `creatorName` | string | No | Display name at the top of the page. On create it defaults to your account's first + last name. | > | `creatorBio` | string | No | Short bio under the name | > | `username` | string | Yes | Page username — 3-30 letters, numbers, hyphens or underscores, stored lowercase. It is also your store subdomain (`https://{username}.pocketsflow.com`), so changing it moves your storefront. Required when creating. `400` if another account has it. | > | `socialLinks` | array of object | No | Social profile links (icons). Entries without a non-empty `name` and `url` are dropped; at most 20 are kept. | > | `regularLinks` | array of object | No | Link buttons shown on the page, in order. Same shape and limits as `socialLinks`. | > | `profilePicture` | string | No | Profile picture URL. Send an empty string to clear it, or upload a file with `multipart/form-data` (file field `profilePicture`). | > | `coverImage` | string | No | Cover image URL. Send an empty string to clear it, or upload a file (file field `coverImage`). | > | `images` | array of string | No | Gallery images (existing image URLs or ids). Omit to keep the current gallery; send an empty value to clear it. Upload files with the `images` file field. | > | `template` | string — template1, template2, template3, template4, template5, template6, template7, template8 | No | Legacy layout template. Unknown values fall back to `template1`. | > | `theme` | object | No | Legacy theme object (layout, colors, style) | > | `themeV2` | object | No | Link in Bio v2 theme: `{ templateId, layout (classic\|hero\|storefront), background, button, text, avatar, grainOverlay }` | > | `gaMeasurementId` | string | No | Google Analytics 4 measurement id (`G-XXXXXXXXXX`); empty string to remove. Invalid values are ignored. | > | `selectedProductIds` | array of string | No | Products shown on the page. Must be your products in the key's mode, or the request fails with `400`. Sending this (or `selectedSubscriptionIds`) switches the page to an explicit selection — an empty array hides every product. | > | `selectedSubscriptionIds` | array of string | No | Subscription offers shown on the page. Same rules as `selectedProductIds`. | > | `subscriberForm` | object | No | Newsletter sign-up form: `{ enabled, displayType (popup\|embedded), title, description, buttonText, successMessage, popupSettings }` | > | `bookingEnabled` | boolean | No | Show a booking button on the page | > | `bookingButtonLabel` | string | No | Label of the booking button | > | `showFirstName` | boolean; default: `true` | No | Whether your first name may appear on public surfaces | > | `showLastName` | boolean; default: `true` | No | Whether your last name may appear on public surfaces | > > **Responses** > > | Status | Description | > | - | - | > | `201` | The created page — returns `CreatorPage` | > | `400` | You already have a page, the username is invalid or taken, or a selected product is not yours | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > | `502` | An uploaded image could not be stored — retry | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] PUT /creator-pages > > Partially update your Link in Bio page — only the fields you send change. Changing `username` also moves your store subdomain. JSON or `multipart/form-data` (file fields `profilePicture`, `coverImage`, `images`). > > Operation ID: `updateCreatorPage` > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `creatorName` | string | No | Display name at the top of the page. On create it defaults to your account's first + last name. | > | `creatorBio` | string | No | Short bio under the name | > | `username` | string | No | Page username — 3-30 letters, numbers, hyphens or underscores, stored lowercase. It is also your store subdomain (`https://{username}.pocketsflow.com`), so changing it moves your storefront. Required when creating. `400` if another account has it. | > | `socialLinks` | array of object | No | Social profile links (icons). Entries without a non-empty `name` and `url` are dropped; at most 20 are kept. | > | `regularLinks` | array of object | No | Link buttons shown on the page, in order. Same shape and limits as `socialLinks`. | > | `profilePicture` | string | No | Profile picture URL. Send an empty string to clear it, or upload a file with `multipart/form-data` (file field `profilePicture`). | > | `coverImage` | string | No | Cover image URL. Send an empty string to clear it, or upload a file (file field `coverImage`). | > | `images` | array of string | No | Gallery images (existing image URLs or ids). Omit to keep the current gallery; send an empty value to clear it. Upload files with the `images` file field. | > | `template` | string — template1, template2, template3, template4, template5, template6, template7, template8 | No | Legacy layout template. Unknown values fall back to `template1`. | > | `theme` | object | No | Legacy theme object (layout, colors, style) | > | `themeV2` | object | No | Link in Bio v2 theme: `{ templateId, layout (classic\|hero\|storefront), background, button, text, avatar, grainOverlay }` | > | `gaMeasurementId` | string | No | Google Analytics 4 measurement id (`G-XXXXXXXXXX`); empty string to remove. Invalid values are ignored. | > | `selectedProductIds` | array of string | No | Products shown on the page. Must be your products in the key's mode, or the request fails with `400`. Sending this (or `selectedSubscriptionIds`) switches the page to an explicit selection — an empty array hides every product. | > | `selectedSubscriptionIds` | array of string | No | Subscription offers shown on the page. Same rules as `selectedProductIds`. | > | `subscriberForm` | object | No | Newsletter sign-up form: `{ enabled, displayType (popup\|embedded), title, description, buttonText, successMessage, popupSettings }` | > | `bookingEnabled` | boolean | No | Show a booking button on the page | > | `bookingButtonLabel` | string | No | Label of the booking button | > | `showFirstName` | boolean; default: `true` | No | Whether your first name may appear on public surfaces | > | `showLastName` | boolean; default: `true` | No | Whether your last name may appear on public surfaces | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated page — returns `CreatorPage` | > | `400` | Invalid or taken username, a selected product is not yours, or a validation error | > | `401` | Missing or invalid API key | > | `404` | You have no Link in Bio page yet — create it with `POST /creator-pages` | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > | `502` | An uploaded image could not be stored — retry | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /creator-pages > > Delete your Link in Bio page. Your account subdomain is kept. > > Operation ID: `deleteCreatorPage` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Page deleted — returns `{ message }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | You have no Link in Bio page. Plain-text body. | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] PATCH /creator-pages/username > > Change only the page username. It also becomes your store subdomain (`https://{username}.pocketsflow.com`). > > Operation ID: `updateCreatorPageUsername` > > **Request body** > > Content type: `application/json` > Required fields: `username`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `username` | string | Yes | 3-30 letters, numbers, hyphens or underscores; stored lowercase | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Username changed — returns `{ username, message }` | > | `400` | Missing, invalid or taken username | > | `401` | Missing or invalid API key | > | `404` | You have no Link in Bio page yet — create it with `POST /creator-pages` | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /creator-pages/check-username/\{username} > > Check a Link in Bio username / store subdomain before claiming it. Your own current username counts as available. > > Operation ID: `checkCreatorPageUsername` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `username` | `path` | Yes | string | The username to check | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The username is available — returns `{ message }` | > | `400` | Invalid format, or already taken | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Orders View your one-time product orders | Method | Endpoint | Description | | - | - | - | | `GET` | `/orders` | List all orders | | `GET` | `/orders/{id}` | Get order by ID | > [accordion] GET /orders > > Retrieve your one-time product orders, newest first, paginated. Subscription (recurring) transactions are NOT included here — list every payment (one-time and recurring) with `GET /payments`, and subscribers with `GET /subscriptions/subscribers`. > > Operation ID: `listOrders` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `startDate` | `query` | No | string (date) | Only orders created on/after this date (ISO 8601). Applied only together with `endDate`; an unparseable date is a `400`. | > | `endDate` | `query` | No | string (date) | Only orders created on/before this date (ISO 8601). Applied only together with `startDate`. | > | `productId` | `query` | No | string | Only orders of this product | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `pageSize` | `query` | No | integer; default: `20` | Number of orders per page (maximum 100) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | A page of orders — returns `{ orders: Order[], pagination: Pagination }` | > | `400` | Unparseable `startDate` / `endDate` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /orders/\{id} > > Retrieve one order by its sale id (the `_id` of an order from `GET /orders`, or of a payment from `GET /payments`) — NOT a product id. For a subscription membership and its full payment history, use `GET /orders/subscriptions/{id}` with the subscriber id. > > Operation ID: `getOrder` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Order (sale) id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Order details — returns `OrderDetail` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Partners Become a Pocketsflow partner, refer users, and earn commissions | Method | Endpoint | Description | | - | - | - | | `GET` | `/partners` | Get my partner profile | | `POST` | `/partners` | Become a partner | | `POST` | `/partners/register-referral` | Register a referral signup | | `GET` | `/partners/referrals` | Get referred users | | `GET` | `/partners/referrals/sales` | Get sales from referred users | | `GET` | `/partners/stats` | Get partner stats | > [accordion] GET /partners > > Retrieve your partner profile including referral code and denormalized stats. > > Operation ID: `getPartner` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Partner profile — returns `Partner` | > | `401` | Missing or invalid API key | > | `404` | Not a partner | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /partners > > Register as a Pocketsflow partner. You'll receive a unique referral code to share. When users sign up using your code, you earn commissions on their sales. > > Operation ID: `createPartner` > > **Responses** > > | Status | Description | > | - | - | > | `201` | Partner created successfully — returns `Partner` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `409` | Already a partner | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /partners/register-referral > > Call this after a user signs up through a partner's referral link. Sets the referral code on the authenticated user and increments the partner's signup count. Only accounts created within the last 30 days can attach a referral code, and never their own. > > Operation ID: `registerReferral` > > **Request body** > > Content type: `application/json` > Required fields: `referralCode`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `referralCode` | string | Yes | The partner's referral code from the signup link | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Referral registered successfully | > | `400` | `referralCode` missing or not a string, the account already has a referral, a self-referral, or the account is more than 30 days old | > | `401` | Missing or invalid API key | > | `404` | Invalid or inactive referral code | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /partners/referrals > > List all users who signed up using your referral code. Each user includes their live sales count and total revenue in USD. > > Operation ID: `listReferrals` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `limit` | `query` | No | integer; default: `20` | Referred users per page (maximum 100) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Paginated list of referred users with live sales count and USD revenue — returns `{ data: object[], pagination: PartnerPagination }` | > | `401` | Missing or invalid API key | > | `404` | Not a partner | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /partners/referrals/sales > > Get the live sales of users who signed up through your referral code (test-mode and refunded sales excluded), newest first. Each item carries the seller, amounts, USD revenue and your commission — never buyer data. > > Operation ID: `listReferralSales` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `limit` | `query` | No | integer; default: `20` | Sales per page (maximum 100) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Paginated list of live (non-test, non-refunded) sales of referred users. No buyer data is included. — returns `{ data: object[], pagination: PartnerPagination }` | > | `401` | Missing or invalid API key | > | `404` | Not a partner | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /partners/stats > > Get live-computed aggregated stats: total signups, total sales, total revenue, and total commission earned based on your commission rate. > > Operation ID: `getPartnerStats` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Aggregated partner stats — returns `{ referralCode, commissionRate, totalSignups, totalSales, totalRevenue, totalCommission, active, createdAt }` | > | `401` | Missing or invalid API key | > | `404` | Not a partner | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Payments Query the unified payment ledger — one-time purchases and subscription renewals — sourced from the payment processor | Method | Endpoint | Description | | - | - | - | | `GET` | `/payments` | List payments (unified ledger) | | `GET` | `/payments/{id}` | Get a payment by ID | > [accordion] GET /payments > > Retrieve a paginated ledger of ALL payments — one-time product purchases AND subscription payments (the initial charge plus every renewal). Filter by `type` to narrow to one\_time or subscription. Every payment is a `Sale`. Scoped to the key's test/live mode. > > Operation ID: `listPayments` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `type` | `query` | No | string — one\_time, subscription, all; default: `all` | Payment type: `one_time` (product purchases), `subscription` (subscription charges), or `all` (default) | > | `startDate` | `query` | No | string (date) | Filter payments from this date (ISO 8601) | > | `endDate` | `query` | No | string (date) | Filter payments until this date (ISO 8601) | > | `productId` | `query` | No | string | Filter payments by product id | > | `subscriptionId` | `query` | No | string | Filter payments by subscription offer id | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `pageSize` | `query` | No | integer; default: `20` | Number of payments per page (maximum 100) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | A page of payments — returns `{ payments: Payment[], pagination: Pagination }` | > | `400` | Unparseable `startDate` / `endDate` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /payments/\{id} > > Retrieve a single payment (a `Sale`). Resolves the related product OR subscription offer (subscription payments carry an empty productId), the customer, and a `paymentsPartner` block sourced from the stored payments partner payload. Pass `?live=true` to additionally fetch the authoritative live payment from the payments partner as `paymentsPartnerLive` (degrades gracefully on any error — never fails the request). > > Operation ID: `getPayment` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Payment id (the Sale \_id) | > | `live` | `query` | No | boolean; default: `false` | When true, fetch the authoritative live payment from the payments partner and include it as `paymentsPartnerLive` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Payment details — returns `PaymentDetail` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Posts Create, schedule and send newsletter email campaigns, or send one-off emails | Method | Endpoint | Description | | - | - | - | | `GET` | `/newsletters/posts` | List all posts | | `POST` | `/newsletters/posts` | Create a post | | `GET` | `/newsletters/posts/{id}` | Get post by ID | | `POST` | `/newsletters/posts/{id}` | Update post | | `DELETE` | `/newsletters/posts/{id}` | Delete post | | `POST` | `/newsletters/posts/{id}/send` | Send post now | | `POST` | `/newsletters/send` | Send email | > [accordion] GET /newsletters/posts > > Retrieve your newsletter posts, newest first, optionally only one `status`. Not paginated. > > Operation ID: `listPosts` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `status` | `query` | No | string — draft, scheduled, sending, sent, failed, automation | Only posts with this status | > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of posts — returns `Post[]` | > | `400` | Unknown `status` value | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /newsletters/posts > > Create a newsletter post. Requires newsletter settings (sender) to be configured first. A post is a `draft` unless you send `status: "scheduled"` with `scheduledAt` (queued for that time) or `status: "automation"`. Sender address, from name and reply-to default to your newsletter settings. Send it now with `POST /newsletters/posts/{id}/send`. > > Operation ID: `createPost` > > **Request body** > > Content type: `application/json` > Required fields: `name`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | Yes | Internal name of the post (shown in your dashboard, not to recipients). Required when creating. | > | `subject` | string | No | Email subject line | > | `preview` | string | No | Inbox preview text shown after the subject | > | `contentHtml` | string | No | HTML body of the email | > | `contentJson` | object | No | Optional editor document the dashboard composer re-opens. Not used for sending — `contentHtml` is what recipients get. | > | `fromName` | string | No | Sender display name. Defaults to the default from name in your newsletter settings. | > | `replyToEmail` | string (email) | No | Reply-to address. Defaults to your configured reply-to (or sender) email. | > | `status` | string — draft, scheduled, automation; default: `draft` | No | `draft` (default), `scheduled` (send at `scheduledAt`), or `automation` (a template only sent by automations). Other statuses are set by the send flow; values you send outside this list are ignored. Any status other than `draft`/`automation` requires `subject`, `preview`, `fromName` and `contentHtml`. | > | `scheduledAt` | string (date-time) | No | When to send the post. Use with `status: "scheduled"`; scheduling checks your monthly send allowance (`402` when exceeded). | > | `scheduledTimezone` | string; default: `UTC` | No | IANA time zone `scheduledAt` is interpreted in | > | `sendToAll` | boolean; default: `false` | No | Send to every active subscriber | > | `subscriberIds` | array of string | No | Send to these subscribers (`_id`s from `GET /newsletters/subscribers`) | > | `productIds` | array of string | No | Send to everyone who bought these products / subscription offers. Ids outside the key's test/live mode are dropped. | > | `tags` | array of string | No | Send to subscribers carrying any of these tags | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The created post — returns `Post` | > | `400` | Newsletter settings are not configured, or a non-draft status is missing required fields | > | `401` | Missing or invalid API key | > | `402` | Scheduling would exceed your monthly send allowance (`code: SEND_ALLOWANCE_EXCEEDED`, plus `used`, `allowance`, `remaining`, `projected`) | > | `403` | Your account is restricted from sending (`error: SELLER_BLOCKED`), your email sending is paused (`error: EMAIL_SENDING_PAUSED`, scheduling only), scheduling needs a paid plan (`error: PAID_PLAN_REQUIRED`, free plan; drafts stay free) or you have more subscribers than your plan allows (`error: PLAN_LIMIT_EXCEEDED`) | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | New-sender daily limit (`code: DAILY_SEND_LIMIT`), or rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /newsletters/posts/\{id} > > Retrieve one of your newsletter posts (a malformed id answers `404`) > > Operation ID: `getPost` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Post id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The post — returns `Post` | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /newsletters/posts/\{id} > > Partially update a post — only the fields you send change. Sent posts cannot be edited (`400`). Setting `status: "scheduled"` with `scheduledAt` (re)queues the post after the send-allowance check; moving a scheduled post to `draft` unschedules it. > > Operation ID: `updatePost` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Post id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | Internal name of the post (shown in your dashboard, not to recipients). Required when creating. | > | `subject` | string | No | Email subject line | > | `preview` | string | No | Inbox preview text shown after the subject | > | `contentHtml` | string | No | HTML body of the email | > | `contentJson` | object | No | Optional editor document the dashboard composer re-opens. Not used for sending — `contentHtml` is what recipients get. | > | `fromName` | string | No | Sender display name. Defaults to the default from name in your newsletter settings. | > | `replyToEmail` | string (email) | No | Reply-to address. Defaults to your configured reply-to (or sender) email. | > | `status` | string — draft, scheduled, automation; default: `draft` | No | `draft` (default), `scheduled` (send at `scheduledAt`), or `automation` (a template only sent by automations). Other statuses are set by the send flow; values you send outside this list are ignored. Any status other than `draft`/`automation` requires `subject`, `preview`, `fromName` and `contentHtml`. | > | `scheduledAt` | string (date-time) | No | When to send the post. Use with `status: "scheduled"`; scheduling checks your monthly send allowance (`402` when exceeded). | > | `scheduledTimezone` | string; default: `UTC` | No | IANA time zone `scheduledAt` is interpreted in | > | `sendToAll` | boolean; default: `false` | No | Send to every active subscriber | > | `subscriberIds` | array of string | No | Send to these subscribers (`_id`s from `GET /newsletters/subscribers`) | > | `productIds` | array of string | No | Send to everyone who bought these products / subscription offers. Ids outside the key's test/live mode are dropped. | > | `tags` | array of string | No | Send to subscribers carrying any of these tags | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated post — returns `Post` | > | `400` | The post was already sent, or a non-draft status is missing required fields | > | `401` | Missing or invalid API key | > | `402` | Scheduling would exceed your monthly send allowance (`code: SEND_ALLOWANCE_EXCEEDED`) | > | `403` | Your account is restricted from sending (`error: SELLER_BLOCKED`), your email sending is paused (`error: EMAIL_SENDING_PAUSED`) or scheduling needs a paid plan (`error: PAID_PLAN_REQUIRED`, free plan; saving a draft stays free) | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | New-sender daily limit (`code: DAILY_SEND_LIMIT`), or rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /newsletters/posts/\{id} > > Delete a newsletter post (a scheduled post is unscheduled first). Returns the deleted post. > > Operation ID: `deletePost` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Post id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The deleted post — returns `Post` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /newsletters/posts/\{id}/send > > Queue the post for immediate delivery to its audience (`sendToAll`, `subscriberIds`, `productIds`, `tags`). The post moves to `sending`, then `sent` (or `failed`). Requires a verified sender email. Calling it again while the post is sending is a no-op (`Post is already sending`). > > Operation ID: `sendPost` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Post id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The post was queued for sending — returns `{ message, post: Post }` | > | `400` | Sender email not verified, the post was already sent, or it is an automation post | > | `401` | Missing or invalid API key | > | `402` | The send would exceed your monthly send allowance (`code: SEND_ALLOWANCE_EXCEEDED`) | > | `403` | Your account is restricted from sending (`error: SELLER_BLOCKED`), your email sending is paused after too many bounces or spam reports (`error: EMAIL_SENDING_PAUSED`), sending campaigns needs a paid plan (`error: PAID_PLAN_REQUIRED`, free plan) or you have more subscribers than your plan allows (`error: PLAN_LIMIT_EXCEEDED`) | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | New-sender daily limit (`code: DAILY_SEND_LIMIT`), or rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /newsletters/send > > Send an email to up to 100 recipients programmatically. Requires a verified sender email (configure it in Newsletters → Settings). The email is sent with your standard footer, physical address, and unsubscribe link, and is recorded as a sent post (source: api). Recipients who unsubscribed from you are skipped (listed in `skipped`); the rest count against your monthly send allowance. > > Operation ID: `sendEmail` > > **Request body** > > Content type: `application/json` > Required fields: `to`, `subject`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `to` | string (email) \| array of string | Yes | A recipient email address, or an array of 1-100 addresses | > | `subject` | string | Yes | Email subject line | > | `html` | string | No | HTML body of the email. Required unless `text` is provided. | > | `text` | string | No | Plain-text body. Used as the text alternative; if `html` is omitted, a simple HTML body is generated from it. | > | `fromName` | string | No | Sender display name. Defaults to your newsletter settings' default from name. | > | `replyTo` | string (email) | No | Reply-to address. Defaults to your configured reply-to (or sender) email. | > | `preview` | string | No | Inbox preview text | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Email sent — or, when every recipient has unsubscribed, nothing sent (`status: "skipped"`, `id: null`, not metered) — returns `{ id, accepted: string[], skipped: string[], skippedCount, status }` | > | `400` | Validation error (invalid recipients, missing subject/body, ...) — returned as `{ error }` | > | `401` | Missing or invalid API key | > | `402` | The send would exceed your monthly send allowance (`code: SEND_ALLOWANCE_EXCEEDED`) | > | `403` | Sender email not verified (`error: EMAIL_SENDER_NOT_VERIFIED`), account restricted (`error: SELLER_BLOCKED`), or email sending paused after too many bounces or spam reports (`error: EMAIL_SENDING_PAUSED`) | > | `429` | New-sender daily limit (`code: DAILY_SEND_LIMIT`), or rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > | `502` | No emails could be sent (`error: EMAIL_SEND_FAILED`) | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Products Create and manage your one-time digital products. Subscription (recurring) offers are a separate resource — see Subscriptions. | Method | Endpoint | Description | | - | - | - | | `GET` | `/products` | List all products | | `POST` | `/products` | Create a product | | `GET` | `/products/{id}` | Get product by ID | | `DELETE` | `/products/{id}` | Delete product | | `POST` | `/products/update/{id}` | Update product | | `POST` | `/products/copy/{id}` | Copy a catalog item | > [accordion] GET /products > > Retrieve your one-time products in the key's mode, newest first. Returns a bare array (not paginated). Subscription (recurring) offers are a separate resource — list them with `GET /subscriptions`. > > Operation ID: `listProducts` > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of products — returns `Product[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /products > > Create a new one-time product. Send JSON, or `multipart/form-data` to upload `file`, `thumbnail` and `images`. Pay-what-you-want products (`payWant: true`) must also send `hasProductPage: "yes"`. Fires the `product.created` webhook. > > Operation ID: `createProduct` > > **Request body** > > Content type: `application/json` > Required fields: `name`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | Yes | Product name. Required when creating. | > | `price` | number; default: `0` | No | Price in your account currency (`currency` on `GET /users/me`). Decimal amount in major units (e.g. `29.99`), not cents. `0` makes the product free. | > | `compareAtPrice` | number | No | Optional merchandising price shown crossed out next to `price`. Display only — it never affects what the buyer is charged. | > | `description` | string | No | Product description | > | `subtitle` | string | No | Product subtitle | > | `published` | boolean; default: `true` | No | Whether the product is published (visible and purchasable). New products are always created published; send `false` on update to unpublish. | > | `slug` | string | No | URL slug for the product page | > | `thumbnail` | string | No | Thumbnail image URL. When empty, the first of `images` is used. | > | `images` | array of string | No | Gallery image references (image ids). Upload new images with `multipart/form-data` (file field `images`). | > | `hasProductPage` | string — yes, no | No | Whether the product has its own product page. Must be `"yes"` whenever `payWant` is `true` in the same request — otherwise the request is rejected with `400`. | > | `payWant` | boolean; default: `false` | No | Enable pay-what-you-want pricing. Requires `hasProductPage: "yes"` in the same request. | > | `minPrice` | number | No | Minimum price for pay-what-you-want (decimal, account currency) | > | `maxPrice` | number | No | Maximum price for pay-what-you-want (decimal, account currency) | > | `refundPolicy` | string | No | Id of one of your refund policies (`_id` from `POST /refunds` / `GET /refunds`) — not policy text. Empty string for none. | > | `showSales` | boolean; default: `true` | No | Show the sales count on the product page | > | `showReviews` | boolean; default: `true` | No | Show reviews on the product page | > | `hasFirstName` | boolean; default: `false` | No | Collect the buyer's first name at checkout | > | `hasLastName` | boolean; default: `false` | No | Collect the buyer's last name at checkout | > | `productType` | string — file, url, course, credits | No | Catalog type. Additive `credits` is prepaid balance with optional auto-refill. Absent on legacy products. | > | `availability` | string — available, preorder, waitlist | No | `available` (default): on sale. `preorder`: pay now, content unlocks on `releaseAt` (not for `credits`). `waitlist`: no checkout; collects emails. | > | `releaseAt` | string (date-time) | No | Pre-order release date (ISO 8601). Required with `preorder`; in the future, at most two years away. | > | `file` | string | No | URL of the downloadable file (file products). Upload a file with `multipart/form-data` (file field `file`). | > | `url` | string | No | Link delivered to the buyer (url products) | > | `ctaText` | string | No | Buy-button label key or text (defaults to `buyForPrice`) | > | `checkoutText` | string | No | Extra text shown on the checkout page | > | `thankYouText` | string | No | Text shown after a successful purchase | > | `creditAutoRefill` | object | No | Seller auto-refill setting. `topOffCents` is integer cents (two decimal places). Enabling without a positive top-off is ignored. | > > **Responses** > > | Status | Description | > | - | - | > | `201` | The created product — returns `Product` | > | `400` | Validation error — e.g. `payWant` without `hasProductPage: "yes"` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /products/\{id} > > Retrieve one of your one-time products. A subscription (recurring) offer's id 404s here with a hint — fetch it with `GET /subscriptions/{id}` instead. > > Operation ID: `getProduct` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Product id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The product — returns `Product` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /products/\{id} > > Delete one of your one-time products. Fires the `product.deleted` webhook. To delete a subscription (recurring) offer, use `DELETE /subscriptions/{id}`. > > Operation ID: `deleteProduct` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Product id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Product deleted — returns `{ message }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /products/update/\{id} > > Partially update one of your one-time products — send only the fields to change (JSON or `multipart/form-data`). If the request sets `payWant: true` it must also send `hasProductPage: "yes"`. Fires the `product.updated` webhook. Subscription (recurring) offers cannot be updated with an API key. > > Operation ID: `updateProduct` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Product id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | Product name. Required when creating. | > | `price` | number; default: `0` | No | Price in your account currency (`currency` on `GET /users/me`). Decimal amount in major units (e.g. `29.99`), not cents. `0` makes the product free. | > | `compareAtPrice` | number | No | Optional merchandising price shown crossed out next to `price`. Display only — it never affects what the buyer is charged. | > | `description` | string | No | Product description | > | `subtitle` | string | No | Product subtitle | > | `published` | boolean; default: `true` | No | Whether the product is published (visible and purchasable). New products are always created published; send `false` on update to unpublish. | > | `slug` | string | No | URL slug for the product page | > | `thumbnail` | string | No | Thumbnail image URL. When empty, the first of `images` is used. | > | `images` | array of string | No | Gallery image references (image ids). Upload new images with `multipart/form-data` (file field `images`). | > | `hasProductPage` | string — yes, no | No | Whether the product has its own product page. Must be `"yes"` whenever `payWant` is `true` in the same request — otherwise the request is rejected with `400`. | > | `payWant` | boolean; default: `false` | No | Enable pay-what-you-want pricing. Requires `hasProductPage: "yes"` in the same request. | > | `minPrice` | number | No | Minimum price for pay-what-you-want (decimal, account currency) | > | `maxPrice` | number | No | Maximum price for pay-what-you-want (decimal, account currency) | > | `refundPolicy` | string | No | Id of one of your refund policies (`_id` from `POST /refunds` / `GET /refunds`) — not policy text. Empty string for none. | > | `showSales` | boolean; default: `true` | No | Show the sales count on the product page | > | `showReviews` | boolean; default: `true` | No | Show reviews on the product page | > | `hasFirstName` | boolean; default: `false` | No | Collect the buyer's first name at checkout | > | `hasLastName` | boolean; default: `false` | No | Collect the buyer's last name at checkout | > | `productType` | string — file, url, course, credits | No | Catalog type. Additive `credits` is prepaid balance with optional auto-refill. Absent on legacy products. | > | `availability` | string — available, preorder, waitlist | No | `available` (default): on sale. `preorder`: pay now, content unlocks on `releaseAt` (not for `credits`). `waitlist`: no checkout; collects emails. | > | `releaseAt` | string (date-time) | No | Pre-order release date (ISO 8601). Required with `preorder`; in the future, at most two years away. | > | `file` | string | No | URL of the downloadable file (file products). Upload a file with `multipart/form-data` (file field `file`). | > | `url` | string | No | Link delivered to the buyer (url products) | > | `ctaText` | string | No | Buy-button label key or text (defaults to `buyForPrice`) | > | `checkoutText` | string | No | Extra text shown on the checkout page | > | `thankYouText` | string | No | Text shown after a successful purchase | > | `creditAutoRefill` | object | No | Seller auto-refill setting. `topOffCents` is integer cents (two decimal places). Enabling without a positive top-off is ignored. | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated product — returns `Product` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /products/copy/\{id} > > Duplicate one of your one-time products (or a subscription offer, whichever owns the id) as a NEW item. Send `{ "testMode": false }` to copy a test-mode offer into live mode ("Copy to live"); omit the body to copy within the same mode. The copy gets a deduplicated "Name (Copy)" name and starts unpublished when copied into live mode. > > Operation ID: `copyProduct` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Product or subscription offer id to copy | > > **Request body** > > Content type: `application/json` (body optional) > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `testMode` | boolean | No | Target mode of the copy. Omit to copy within the source's own mode. | > > **Responses** > > | Status | Description | > | - | - | > | `201` | The newly created copy (a product or a subscription offer) — returns `Product \| SubscriptionOffer` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Refunds Refund POLICIES — the refund terms shown to buyers at checkout, referenced by products via `refundPolicy`. These endpoints do not refund payments: refunding a payment is done from the dashboard and has no API-key endpoint. Refunds that happen arrive as the `order.refunded` webhook and `isRefunded` on payments. | Method | Endpoint | Description | | - | - | - | | `GET` | `/refunds` | List refund policies | | `POST` | `/refunds` | Create a refund policy | | `GET` | `/refunds/{id}` | Get refund policy by ID | | `POST` | `/refunds/{id}` | Update a refund policy | | `DELETE` | `/refunds/{id}` | Delete a refund policy | > [accordion] GET /refunds > > Retrieve your refund POLICIES in the key's mode, newest first, each with `appliedTo` — how many products use it > > Operation ID: `listRefundPolicies` > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of refund policies — returns `RefundPolicy[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /refunds > > Create a refund POLICY (refund terms shown at checkout) that products reference by id (`refundPolicy`). This does NOT refund a payment — refunds are issued from the dashboard. > > Operation ID: `createRefundPolicy` > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | Internal name of the policy | > | `policy` | string | No | Policy text shown to buyers | > | `period` | number; default: `0` | No | Length of the refund window | > | `periodType` | string — days, weeks; default: `days` | No | Unit of `period` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The created refund policy — returns `RefundPolicy` | > | `400` | A field has the wrong type (`period` must be a non-negative number, `periodType` `days` or `weeks`) | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /refunds/\{id} > > PUBLIC (no API key) — retrieve a refund POLICY by its id. Checkout renders it for buyers. > > Operation ID: `getRefundPolicy` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Refund policy id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The refund policy — returns `RefundPolicy` | > | `404` | Refund policy not found | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /refunds/\{id} > > Update one of your refund POLICIES — only the fields you send change. > > Operation ID: `updateRefundPolicy` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Refund policy id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | | > | `policy` | string | No | | > | `period` | number | No | | > | `periodType` | string — days, weeks | No | | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated refund policy — returns `RefundPolicy` | > | `400` | A field has the wrong type (`period` must be a non-negative number, `periodType` `days` or `weeks`) | > | `401` | Missing or invalid API key | > | `404` | No refund policy of yours with this id | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /refunds/\{id} > > Delete one of your refund POLICIES. Returns the deleted policy. Products that referenced it keep the stale id — update them. > > Operation ID: `deleteRefundPolicy` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Refund policy id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The deleted refund policy — returns `RefundPolicy` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Refund policy not found | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Reviews Read your product reviews | Method | Endpoint | Description | | - | - | - | | `GET` | `/reviews` | List product reviews | > [accordion] GET /reviews > > Retrieve all reviews across your products in the key's mode, newest first. Not paginated; filtering is not supported. > > Operation ID: `listReviews` > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of reviews — returns `Review[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Subscribers Manage your newsletter email contacts and product audiences | Method | Endpoint | Description | | - | - | - | | `GET` | `/newsletters/audiences` | List product audiences | | `POST` | `/newsletters/audiences/sync` | Add a product's customers to your subscribers | | `GET` | `/newsletters/subscribers` | List all subscribers | | `GET` | `/newsletters/subscribers/{id}` | Get subscriber by ID | | `DELETE` | `/newsletters/subscribers/{id}` | Remove subscriber | > [accordion] GET /newsletters/audiences > > Every product and subscription in the key's mode, with how many people bought it (`customers`) and how many of them are active email contacts (`subscribers`). Biggest audiences first. > > Operation ID: `listProductAudiences` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Product audiences — returns `object[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /newsletters/audiences/sync > > Adds everyone who bought the product (or every buyer, when `productId` is omitted) to your subscribers and links them to what they bought. Contacts who unsubscribed stay unsubscribed. > > Operation ID: `syncProductAudience` > > **Request body** > > Content type: `application/json` (body optional) > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `productId` | string | No | Product or subscription ID. Omit for all buyers. | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Sync result: `customers` (buyers found), `added` (new contacts), `updated` (existing contacts newly linked), `unsubscribed` (opted-out buyers, linked but never emailed) — returns `{ customers, added, updated, unsubscribed }` | > | `400` | Invalid productId | > | `401` | Missing or invalid API key | > | `403` | Would exceed your plan's subscriber limit (`error: PLAN_LIMIT_EXCEEDED`) | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /newsletters/subscribers > > Retrieve all your newsletter contacts, newest first. Each carries `productIds`: the products and subscriptions they bought. Not paginated. > > Operation ID: `listEmailSubscribers` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `productId` | `query` | No | string | Only contacts in this product audience | > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of subscribers — returns `EmailSubscriber[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /newsletters/subscribers/\{id} > > Retrieve one of your newsletter contacts > > Operation ID: `getEmailSubscriber` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscriber id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The subscriber — returns `EmailSubscriber` | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /newsletters/subscribers/\{id} > > Delete a contact from your list. Returns the deleted contact. > > Operation ID: `deleteEmailSubscriber` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscriber id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The deleted subscriber — returns `EmailSubscriber` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Subscriptions Manage subscription offers (the recurring products you sell) and subscribers (buyers' memberships). The hosted subscriber portal link is delivered as `portalUrl` on subscribers and in subscription webhooks — pass it to the buyer unchanged (its `token` is what allows cancel/resume). | Method | Endpoint | Description | | - | - | - | | `GET` | `/orders/subscriptions/{id}` | Get a subscriber with payment history (via Orders) | | `GET` | `/subscriptions` | List all subscription offers | | `POST` | `/subscriptions` | Create a subscription offer | | `GET` | `/subscriptions/subscribers` | List subscribers | | `GET` | `/subscriptions/subscribers/{id}` | Get a subscriber with payment history | | `GET` | `/subscriptions/{id}` | Get subscription offer by ID | | `DELETE` | `/subscriptions/{id}` | Delete a subscription offer | | `POST` | `/subscriptions/{id}/cancel` | Cancel a subscriber's subscription | | `POST` | `/subscriptions/{id}/pause` | Pause a subscriber's subscription | | `POST` | `/subscriptions/{id}/resume` | Resume a paused subscription | > [accordion] GET /orders/subscriptions/\{id} > > Retrieve a single subscriber (SubscriptionCustomer) by id together with its subscription offer, customer, legacy card-subscription data (when applicable), the payments-partner-sourced live `status`, and `payments` — every subscription `Sale` for this membership (the initial charge plus every renewal). `{id}` is the subscriber `_id`; a malformed or unknown id answers `404`. > > Operation ID: `getSubscriberOrderHistory` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscriber id (the SubscriptionCustomer \_id) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscriber details with payment history — returns `{ subscriptionCustomer: Subscriber, subscription: SubscriptionOffer \| null, customer: Customer \| null, status, payments: Payment[] }` | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /subscriptions > > Retrieve all of your subscription OFFERS (the recurring products you sell) in the key's mode. To list your subscribers (buyers) instead, use `GET /subscriptions/subscribers`. > > Operation ID: `listSubscriptionOffers` > > **Responses** > > | Status | Description | > | - | - | > | `200` | List of subscription offers — returns `SubscriptionOffer[]` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /subscriptions > > Create a recurring subscription offer. Accepts JSON for API clients and multipart/form-data when uploading files or images. Pricing is charged in USD while multi-currency is disabled. > > Operation ID: `createSubscriptionOffer` > > **Request body** > > Content type: `application/json` or `multipart/form-data` > Required fields: `name`, `price`, `frequency`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | Yes | Subscription offer name | > | `subtitle` | string | No | Short offer subtitle | > | `description` | string | No | Offer description | > | `price` | number | Yes | Recurring price in USD. Decimal amount in major units, not cents. | > | `frequency` | string — weekly, monthly, yearly | Yes | Billing frequency | > | `trialPeriod` | integer; default: `0` | No | Trial duration in days | > | `published` | boolean; default: `true` | No | Whether the offer is published | > | `redirectBackUrl` | string (uri) | No | Return URL used by the customer billing portal; defaults to [https://pocketsflow.com](https://pocketsflow.com) | > | `refundPolicy` | string | No | Refund policy id (from `POST /refunds`) | > | `checkoutText` | string | No | | > | `portalText` | string | No | | > | `privacyPolicy` | string (uri) | No | | > | `termsOfService` | string (uri) | No | | > | `thumbnail` | string (uri) | No | | > | `images` | array of string | No | Existing image references or uploaded images in multipart requests | > | `file` | string \| object | No | File URL or uploaded file reference | > | `url` | string (uri) | No | | > | `isFile` | boolean | No | | > | `hasFirstName` | boolean; default: `false` | No | | > | `hasLastName` | boolean; default: `false` | No | | > | `callbackUrl` | string (uri) | No | | > | `hasCallbackUrl` | boolean | No | | > | `productType` | string — file, url, course, credits | No | Catalog type. Additive `credits` is prepaid balance with optional auto-refill. | > | `creditAutoRefill` | object | No | Seller auto-refill setting. `topOffCents` is integer cents. | > | `ctaText` | string | No | | > | `thankYouText` | string | No | | > | `slug` | string | No | | > | `hasProductPage` | boolean | No | | > | `showSales` | boolean | No | | > | `showReviews` | boolean | No | | > | `maxPrice` | number | No | | > | `minPrice` | number | No | | > | `design` | object | No | | > | `colors` | object | No | | > | `pageStyle` | object | No | | > | `checkoutStyle` | object | No | | > | `checkoutColors` | object | No | | > > **Responses** > > | Status | Description | > | - | - | > | `201` | Subscription offer created successfully — returns `SubscriptionOffer` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /subscriptions/subscribers > > Retrieve a paginated list of your subscribers (buyers with a membership in one of your subscription offers). Each subscriber carries a payments-partner-sourced live `status`, `cancelAtPeriodEnd`, the membership id (`membershipId`), the `portalUrl` to hand to the buyer, and the joined subscription offer. Scoped to the key's test/live mode. > > Operation ID: `listSubscribers` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `status` | `query` | No | string — incomplete, incomplete\_expired, trialing, active, past\_due, canceled, unpaid, succeeded, refunded, paused | Filter subscribers by their payments-partner-sourced status | > | `buyerEmail` | `query` | No | string | Filter subscribers by buyer email | > | `email` | `query` | No | string | Alias for buyerEmail | > | `subscriptionId` | `query` | No | string | Filter subscribers by subscription offer id | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `pageSize` | `query` | No | integer; default: `20` | Number of subscribers per page | > > **Responses** > > | Status | Description | > | - | - | > | `200` | A page of subscribers — returns `{ subscribers: Subscriber[], pagination: Pagination }` | > | `400` | `status` is not a known status, or `buyerEmail` / `email` / `subscriptionId` is not a single valid value | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /subscriptions/subscribers/\{id} > > Retrieve a single subscriber, its subscription offer, the customer record, the payments-partner-sourced live `status`, and its full payment history (`payments` = every subscription `Sale` — the initial charge plus every renewal). Pass `?live=true` to additionally fetch the authoritative membership status from the payments partner as `membership` (degrades gracefully to the stored status on any payments partner error — never fails the request). > > Operation ID: `getSubscriber` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscriber id (the SubscriptionCustomer \_id) | > | `live` | `query` | No | boolean; default: `false` | When true, fetch authoritative live membership status from the payments partner and include it as `membership` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscriber details with payment history — returns `{ subscriber: Subscriber, subscription: SubscriptionOffer \| null, customer: Customer \| null, status, payments: Payment[], membership }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /subscriptions/\{id} > > Retrieve one of your subscription OFFERS in the key's mode. > > Operation ID: `getSubscriptionOffer` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscription offer id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The subscription offer — returns `SubscriptionOffer` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /subscriptions/\{id} > > Delete one of your subscription OFFERS in the key's mode. This removes the offer from your catalog; it does not cancel existing subscribers — use `POST /subscriptions/{id}/cancel` with a subscriber id for that. > > Operation ID: `deleteSubscriptionOffer` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Subscription offer id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscription offer deleted — returns `{ message, id }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /subscriptions/\{id}/cancel > > Schedules the subscriber's membership to cancel at the end of the current billing period (same as the subscriber portal). Access continues until then; `cancelAtPeriodEnd` becomes true. `{id}` is the subscriber `_id` or membership id (`mem_…`) — not a `sub_…` id. > > Operation ID: `cancelSubscription` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | The subscriber's `_id` (SubscriptionCustomer) or its membership id (`mem_…`), as returned by `GET /subscriptions/subscribers` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscription canceled successfully — returns `{ success, status, cancelAtPeriodEnd, manageUrl }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /subscriptions/\{id}/pause > > Pauses payment collection on the subscriber's membership. The buyer keeps access and is not charged until `/resume`. If the payments partner refuses, nothing changes (502). `{id}` is the subscriber `_id` or membership id (`mem_…`). > > Operation ID: `pauseSubscription` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | The subscriber's `_id` (SubscriptionCustomer) or its membership id (`mem_…`), as returned by `GET /subscriptions/subscribers` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscription paused successfully — returns `{ success, status, paused, cancelAtPeriodEnd, manageUrl }` | > | `400` | The subscriber has no membership on record, so collection cannot be paused | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > | `502` | The payments partner refused the pause; nothing was changed | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /subscriptions/\{id}/resume > > Restarts payment collection on a paused membership, or otherwise reverses a pending cancel-at-period-end (same as the subscriber portal). `{id}` is the subscriber `_id` or membership id (`mem_…`). > > Operation ID: `resumeSubscription` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | The subscriber's `_id` (SubscriptionCustomer) or its membership id (`mem_…`), as returned by `GET /subscriptions/subscribers` | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Subscription resumed successfully — returns `{ success, status, cancelAtPeriodEnd, manageUrl }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Upsells Configure upsell offers shown at checkout | Method | Endpoint | Description | | - | - | - | | `GET` | `/upsells` | List all upsells | | `POST` | `/upsells` | Create an upsell | | `GET` | `/upsells/{id}` | Get upsell by ID | | `POST` | `/upsells/{id}` | Update upsell | | `DELETE` | `/upsells/{id}` | Delete upsell | > [accordion] GET /upsells > > Retrieve your upsells in the key's mode, plus `salesWithUpsells` — your sales that carry an upsell > > Operation ID: `listUpsells` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Upsells and the sales that include one — returns `{ upsells: Upsell[], salesWithUpsells: object[] }` | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /upsells > > Create a new upsell offer. `upsellProductId` must be one of your products (`404` otherwise) and `mainProductIds` a non-empty list of your own products in the key's mode (`400` otherwise). `upsellPrice` must be 0 or more. > > Operation ID: `createUpsell` > > **Request body** > > Content type: `application/json` > Required fields: `mainProductIds`, `upsellProductId`, `upsellPrice`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `mainProductIds` | array of string | Yes | Product IDs that trigger this upsell (required) | > | `upsellProductId` | string | Yes | Product ID to offer as upsell (required) | > | `upsellPrice` | number | Yes | Upsell price (required). Decimal amount in your account currency, not cents. | > | `compareAtPrice` | number | No | Optional crossed-out price shown next to `upsellPrice` | > | `name` | string | No | Upsell name | > | `offer` | string | No | Offer headline text | > | `upsellDescription` | string | No | Upsell description shown to customer | > | `primaryButtonText` | string | No | Primary button text (e.g., 'Yes, add this!') | > | `secondaryButtonText` | string | No | Secondary button text (e.g., 'No thanks') | > | `active` | boolean; default: `true` | No | Whether upsell is active | > | `upsellBackground` | string | No | Card background color override (hex, e.g. '#fffbe6') | > | `upsellBorder` | string | No | Card border color override (hex, e.g. '#d9c98f') | > | `upsellHeadline` | string | No | Headline text color override (hex, e.g. '#14532d') | > | `upsellDescriptionColor` | string | No | Description text color override (hex) | > | `upsellCheckboxColor` | string | No | Checkbox accent color override (hex) | > | `upsellCheckboxBackground` | string | No | Unchecked checkbox box fill color override (hex) | > | `upsellHeadingFont` | string | No | Title font override (font key, e.g. 'poppins') | > | `upsellBodyFont` | string | No | Body font override (font key, e.g. 'serif') | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The created upsell — returns `Upsell` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | `upsellProductId` is not one of your products | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /upsells/\{id} > > Retrieve one of your upsells > > Operation ID: `getUpsell` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Upsell id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The upsell — returns `Upsell` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /upsells/\{id} > > Update an existing upsell. `upsellProductId`, `upsellPrice` and `mainProductIds` change only when sent (and are validated like on create); every other listed field is written as sent — omitted ones are cleared — so send every text, style and `active` field you want to keep. `PUT /upsells/{id}` is an alias of this endpoint. > > Operation ID: `updateUpsell` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Upsell id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `name` | string | No | | > | `offer` | string | No | | > | `mainProductIds` | array of string | No | Product IDs that trigger this upsell | > | `upsellProductId` | string | No | | > | `upsellPrice` | number | No | | > | `compareAtPrice` | number | No | | > | `upsellDescription` | string | No | | > | `primaryButtonText` | string | No | | > | `secondaryButtonText` | string | No | | > | `active` | boolean | No | | > | `upsellBackground` | string | No | | > | `upsellBorder` | string | No | | > | `upsellHeadline` | string | No | | > | `upsellDescriptionColor` | string | No | | > | `upsellCheckboxColor` | string | No | | > | `upsellCheckboxBackground` | string | No | | > | `upsellHeadingFont` | string | No | | > | `upsellBodyFont` | string | No | | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated upsell — returns `Upsell` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /upsells/\{id} > > Delete an upsell offer > > Operation ID: `deleteUpsell` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Upsell id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Upsell deleted — returns `{ message }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Webhooks Register endpoints that receive real-time event notifications. Delivery format, headers, signature verification and every event payload are documented in [Webhook events](/api-webhooks/events). | Method | Endpoint | Description | | - | - | - | | `GET` | `/webhooks` | List all webhooks | | `POST` | `/webhooks` | Create a webhook | | `GET` | `/webhooks/{id}` | Get webhook by ID | | `PATCH` | `/webhooks/{id}` | Update webhook | | `DELETE` | `/webhooks/{id}` | Delete webhook | | `POST` | `/webhooks/{id}/rotate-secret` | Rotate a webhook's signing secret | | `POST` | `/webhooks/{id}/test` | Test webhook | | `GET` | `/delivered-webhooks` | List webhook deliveries | | `GET` | `/delivered-webhooks/{id}` | Get a webhook delivery | | `POST` | `/delivered-webhooks/{id}/redeliver` | Redeliver a webhook | > [accordion] GET /webhooks > > Retrieve your webhook endpoints in the key's mode, newest first. Secrets are omitted. > > Operation ID: `listWebhooks` > > **Responses** > > | Status | Description | > | - | - | > | `200` | Your webhook endpoints — returns `{ webhooks: Webhook[] }` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /webhooks > > Register an endpoint that receives the selected events. The endpoint is created in the key's mode and only receives events from that mode. The response carries the signing `secret` — store it (you can also read it with `GET /webhooks/{id}` or replace it with `POST /webhooks/{id}/rotate-secret`). New webhooks start active; use `PATCH /webhooks/{id}` to disable one. > > Operation ID: `createWebhook` > > **Request body** > > Content type: `application/json` > Required fields: `url`, `events`. > > | Field | Type | Required | Description | > | - | - | - | - | > | `url` | string (uri) | Yes | Endpoint URL. Must be https\:// and publicly reachable (private / internal addresses are rejected). | > | `events` | array of string | Yes | Events to subscribe to — a non-empty list of known event types (required) | > | `description` | string | No | Optional description (at most 500 characters) | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Webhook created — returns `{ id, url, events: string[], description, secret }` | > | `400` | Missing, non-https or disallowed `url` (`{ error }`), an empty or unknown `events` list (`{ error, invalidEvents }`), or a `description` over 500 characters | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /webhooks/\{id} > > Retrieve one of your webhook endpoints, including its signing `secret` > > Operation ID: `getWebhook` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Webhook id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The webhook — returns `{ webhook: Webhook }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] PATCH /webhooks/\{id} > > Update an endpoint's `url`, `events`, `description`, or `active` flag. Only the fields you send change; they are validated like on create. The response does not include the `secret`. > > Operation ID: `updateWebhook` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Webhook id | > > **Request body** > > Content type: `application/json` > No required fields. > > | Field | Type | Required | Description | > | - | - | - | - | > | `url` | string (uri) | No | New https\:// endpoint URL | > | `events` | array of string | No | Replaces the subscribed events (non-empty) | > | `description` | string | No | | > | `active` | boolean | No | `false` pauses deliveries | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The updated webhook (without `secret`) — returns `{ webhook: Webhook }` | > | `400` | Invalid id, `url`, `events`, `description`, or a non-boolean `active` | > | `401` | Missing or invalid API key | > | `404` | Not found, not yours, or from the other test/live mode | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] DELETE /webhooks/\{id} > > Delete one of your webhook endpoints in the key's mode. > > Operation ID: `deleteWebhook` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Webhook id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | Webhook deleted — returns `{ message }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | No webhook of yours with this id | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /webhooks/\{id}/rotate-secret > > Replace the endpoint's signing secret and return the new one. Deliveries are signed with the new secret immediately — update your verifier first. > > Operation ID: `rotateWebhookSecret` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Webhook id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The new secret — returns `{ id, secret }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | No webhook of yours with this id | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /webhooks/\{id}/test > > Send a sample event to this endpoint only — its first subscribed event type, with a sample `order.completed`-style payload and `test: true` in the body — and return the delivery outcome. The attempt is recorded in the delivery log. > > Operation ID: `testWebhook` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Webhook id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The test delivery outcome (also `200` when your endpoint failed — check `delivered`) — returns `{ message, event, eventId, deliveryId, delivered, status, durationMs, error, results: object[] }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | No webhook of yours with this id | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /delivered-webhooks > > The delivery log: every webhook delivery attempt in the key's mode (including tests and redeliveries), newest first, paginated. Entries are kept for 30 days. > > Operation ID: `listWebhookDeliveries` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `page` | `query` | No | integer; default: `1` | 1-based page number | > | `pageSize` | `query` | No | integer; default: `20` | Number of deliveries per page (maximum 100) | > | `webhookId` | `query` | No | string | Only deliveries to this endpoint | > | `event` | `query` | No | string — order.completed, order.refunded, product.created, product.updated, product.deleted, review\.created, customer.created, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, customer.subscription.pause, customer.subscription.resumed, customer.subscription.trial\_will\_end, invoice.created, invoice.upcoming, invoice.payment\_succeeded, invoice.payment\_failed, payment\_intent.succeeded, payment\_intent.payment\_failed, credit.granted, credit.balance\_changed, credit.auto\_refill.succeeded, credit.auto\_refill.failed, credit.consent.enabled, credit.consent.disabled, test.event | Only deliveries of this event type | > > **Responses** > > | Status | Description | > | - | - | > | `200` | A page of deliveries — returns `{ deliveredWebhooks: WebhookDelivery[], pagination: Pagination }` | > | `400` | Non-positive `page` / `pageSize`, a malformed `webhookId`, or an unknown `event` | > | `401` | Missing or invalid API key | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] GET /delivered-webhooks/\{id} > > Retrieve one delivery-log entry, including the exact body that was sent. > > Operation ID: `getWebhookDelivery` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Delivery id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The delivery — returns `{ deliveredWebhook: WebhookDelivery }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | No delivery of yours with this id | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). > [accordion] POST /delivered-webhooks/\{id}/redeliver > > Send a logged delivery's stored body to its endpoint again (same event id, freshly signed) and record the new attempt. Use it to replay events your endpoint missed. > > Operation ID: `redeliverWebhook` > > **Parameters** > > | Name | Location | Required | Type | Description | > | - | - | - | - | - | > | `id` | `path` | Yes | string | Delivery id | > > **Responses** > > | Status | Description | > | - | - | > | `200` | The redelivery outcome (also `200` when your endpoint failed — check `delivered`) — returns `{ message, delivered, deliveryId, eventId, event, attempt, status, durationMs, error }` | > | `400` | Bad request — malformed JSON or id, or failed validation | > | `401` | Missing or invalid API key | > | `404` | The delivery or its webhook endpoint no longer exists | > | `422` | The stored body cannot be redelivered | > | `429` | Rate limit exceeded — retry after `Retry-After` seconds | > | `500` | Server error — retry with backoff | > > Try it in the [interactive API explorer](https://api.pocketsflow.com/docs). ## Objects The main response objects. Fields marked as money are decimal amounts in major currency units (e.g. `29.99`), never cents, unless the field name ends in `Cents`. ### Product A one-time product in your catalog | Field | Type | Description | | - | - | - | | `_id` | string | Product id (24-character hex MongoDB ObjectId) | | `userId` | string | Owner account id | | `name` | string | | | `subtitle` | string | | | `description` | string | | | `price` | number | Price in the seller's account currency (`currency` on `GET /users/me`). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `compareAtPrice` | number | Optional crossed-out merchandising price; display only. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `payWant` | boolean | Pay-what-you-want pricing enabled | | `minPrice` | number | Pay-what-you-want minimum. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `maxPrice` | number | Pay-what-you-want maximum. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `published` | boolean | | | `hasProductPage` | string — yes, no, unknown | Whether the product has its own page (`unknown` on products that never set it) | | `slug` | string | | | `thumbnail` | string | Cover image URL (list responses fall back to the first gallery image) | | `images` | array of string | Gallery image ids | | `productType` | string — file, url, course, credits | Catalog type. Absent on legacy products. | | `availability` | string — available, preorder, waitlist | `available` (default), `preorder` (pay now, unlocks on `releaseAt`) or `waitlist` (no checkout; collects emails) | | `releaseAt` | string (date-time) | Pre-order release date. Only set while `availability` is `preorder`. | | `releasedAt` | string (date-time) | When the product was last released from pre-order. Read-only. | | `file` | string | Primary file URL | | `url` | string | Delivered link (url products) | | `refundPolicy` | string | Refund policy id, or empty | | `showSales` | boolean | | | `showReviews` | boolean | | | `hasFirstName` | boolean | | | `hasLastName` | boolean | | | `ctaText` | string | | | `checkoutText` | string | | | `thankYouText` | string | | | `creditAutoRefill` | object | | | `testMode` | boolean | Whether the product lives in test mode | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Order An order as listed by `GET /orders`: the one-time `Sale` plus its product, customer reference, fee breakdown and purchased upsells. Includes every field of `Payment` and `OrderFees`, plus: | Field | Type | Description | | - | - | - | | `product` | Product \| null | The purchased product (null if it was deleted) | | `customer` | object | | | `country` | string | Buyer country (ISO code) | | `gross` | number | Gross amount collected (= grossAmount). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `taxes` | number | Tax collected (= taxAmount). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `variantId` | string | Purchased variant id, if any | | `discountId` | string | Applied discount id, if any | | `upsellProduct` | Product \| null | Legacy single upsell product, if one was bought | | `upsellAmount` | number | Amount paid for the legacy upsell. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `purchasedUpsells` | array of object | Upsells bought with this order | ### OrderFees Seller-facing fee breakdown attached to orders. All decimal amounts in the sale currency. | Field | Type | Description | | - | - | - | | `net` | number | amountBeforeTax − affiliateCut − legacy processor fee. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `fee` | number | Legacy processor fee (older card / PayPal sales only). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `platformFee` | number | Pocketsflow platform fee, as locked at checkout (in the order currency). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `platformFeeSource` | string — stored, estimated, none | `stored` = the fee locked at checkout, converted to the order currency; `estimated` = older sale without a stored fee (2% estimate); `none` = legacy card / PayPal sale with no platform line | | `processingFee` | number | Payment processing fee (excludes affiliate commission — see `affiliateFee`). Decimal amount in major currency units (e.g. `29.99`), not cents. | | `affiliateFee` | number | Affiliate commission deducted from this sale. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `totalTransactionCost` | number, nullable | platformFee + processingFee, decimal. Null until the settled amount is known. | | `totalDeductions` | number, nullable | totalTransactionCost + affiliateFee, decimal. Null until the settled amount is known. | | `effectiveFeeRate` | number, nullable | totalTransactionCost as a percentage of the pre-tax amount (e.g. `7.9` = 7.9%). Null until the settled amount is known. | | `netAmount` | number, nullable | Stored settled net amount for the sale, or null when not recorded. Decimal, not cents. | | `affiliateCut` | number | Affiliate commission paid out of this sale. Decimal amount in major currency units (e.g. `29.99`), not cents. | ### Payment A single payment (a `Sale`). Covers BOTH one-time product purchases (`isSubscription: false`) and subscription payments — the initial charge and every renewal (`isSubscription: true`). Money fields are decimal amounts in `currency`, not cents. | Field | Type | Description | | - | - | - | | `_id` | string | Payment (sale) id (24-character hex MongoDB ObjectId) | | `isSubscription` | boolean | true for subscription payments (initial + renewals); false for one-time product purchases | | `billingReason` | string — initial, renewal | Only present on subscription payments: `initial` for the first charge that activates the membership, `renewal` for every recurring charge after it | | `amount` | number | Charged amount (after tax), in the payment currency. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `grossAmount` | number | Gross amount collected from the buyer. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `amountBeforeTax` | number | Amount before tax was applied. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `taxAmount` | number | Tax collected on this payment. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `currency` | string | | | `buyerEmail` | string | | | `firstName` | string | | | `lastName` | string | | | `buyerDevice` | object | The buyer's device and browser at checkout: `type` (mobile, tablet, desktop, bot), `browser`, `browserVersion`, `os`, `osVersion`. Absent on older orders; empty strings mean unknown. | | `isRefunded` | boolean | | | `isDisputed` | boolean | | | `productId` | string | The product purchased. Empty on subscription payments — use `subscriptionId` instead. | | `subscriptionId` | string | The subscription offer this payment belongs to. Empty on one-time product purchases. | | `partnerPaymentId` | string | The payments partner payment (receipt) id backing this sale | | `partnerPlanId` | string | The payments partner plan id this payment was charged against | | `membershipId` | string | The payments partner membership id this subscription payment belongs to (subscription payments only). Matches the subscriber's `membershipId`. | | `createdAt` | string (date-time) | | ### Customer A buyer of yours. One record per buyer email and test/live mode. | Field | Type | Description | | - | - | - | | `_id` | string | Customer id (24-character hex MongoDB ObjectId) | | `buyerEmail` | string | | | `firstName` | string | | | `lastName` | string | | | `country` | string | | | `productId` | string | The product of the buyer's first purchase | | `testMode` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Subscriber A subscriber — a buyer's membership (`SubscriptionCustomer`) in one of your subscription offers. | Field | Type | Description | | - | - | - | | `_id` | string | Subscriber id (24-character hex MongoDB ObjectId) | | `buyerEmail` | string | | | `portalUrl` | string | The subscriber's hosted self-service portal link, including its `?token=…` capability. Send it to the buyer exactly as returned — it is the only link that can cancel or resume; a hand-built `/portal/{subscriptionId}/{subscriberId}` URL without the token opens read-only. Share it only with that buyer. | | `status` | string — incomplete, incomplete\_expired, trialing, active, past\_due, canceled, unpaid, succeeded, refunded, paused | Payments-partner-sourced live membership status, maintained by the membership/payment webhooks | | `active` | boolean | Whether the membership is currently active | | `partnerPlanId` | string | The payments partner PLAN id for this subscriber | | `membershipId` | string | The payments partner MEMBERSHIP id. Accepted as `{id}` by the cancel / pause / resume endpoints. | | `cancelAtPeriodEnd` | boolean | Whether the membership is scheduled to cancel at the end of the current billing period. Stays `active` until the payments partner deactivates it. | | `subscriptionId` | string | The subscription offer this subscriber belongs to | | `firstName` | string | | | `lastName` | string | | | `country` | string | | | `createdAt` | string (date-time) | | | `subscription` | object, nullable | The joined subscription offer | ### SubscriptionOffer A recurring subscription offer owned by the authenticated seller | Field | Type | Description | | - | - | - | | `_id` | string | Subscription offer id (24-character hex MongoDB ObjectId) | | `name` | string | | | `subtitle` | string | | | `description` | string | | | `price` | number | Recurring price. Decimal amount in major units, not cents. | | `frequency` | string — weekly, monthly, yearly | | | `trialPeriod` | integer | | | `published` | boolean | | | `redirectBackUrl` | string (uri) | | | `thumbnail` | string (uri) | | | `images` | array of string | | | `testMode` | boolean | | | `productType` | string — file, url, course, credits | | | `creditAutoRefill` | object | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Discount | Field | Type | Description | | - | - | - | | `_id` | string | Discount id (24-character hex MongoDB ObjectId) | | `name` | string | | | `code` | string | What buyers enter at checkout | | `value` | number | Percent off (`valueType: percentage`) or a fixed decimal amount off in your account currency (`valueType: fixed`) | | `valueType` | string — percentage, fixed; default: `percentage` | | | `mainProductIds` | array of string | Products / subscription offers the code applies to | | `active` | boolean | | | `expiration` | string (date-time), nullable | When the code stops working (checkout rejects it after this date). Absent or null = never expires. | | `used` | integer | Sales that used the code (`GET /discounts` only) | | `testMode` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Upsell A post-purchase / order-bump offer shown at checkout for the `mainProductIds` | Field | Type | Description | | - | - | - | | `_id` | string | Upsell id (24-character hex MongoDB ObjectId) | | `name` | string | | | `offer` | string | Offer headline | | `mainProductIds` | array of string | Products whose checkout shows this upsell | | `upsellProductId` | string | The product being offered | | `upsellPrice` | number | Price of the upsell. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `compareAtPrice` | number | Crossed-out price shown next to `upsellPrice`. Decimal amount in major currency units (e.g. `29.99`), not cents. | | `upsellDescription` | string | | | `primaryButtonText` | string | | | `secondaryButtonText` | string | | | `active` | boolean | | | `showAtCheckout` | boolean | | | `upsellBackground` | string | | | `upsellBorder` | string | | | `upsellHeadline` | string | | | `upsellDescriptionColor` | string | | | `upsellCheckboxColor` | string | | | `upsellCheckboxBackground` | string | | | `upsellHeadingFont` | string | | | `upsellBodyFont` | string | | | `testMode` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Review | Field | Type | Description | | - | - | - | | `_id` | string | Review id (24-character hex MongoDB ObjectId) | | `productId` | string | | | `saleId` | string | The order the review belongs to | | `buyerEmail` | string | | | `rating` | number | Star rating, 1–5 | | `review` | string | Review text | | `testMode` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### RefundPolicy A refund policy — the refund terms shown to buyers at checkout. Products reference it by id (`refundPolicy`). Not a refund of a payment. | Field | Type | Description | | - | - | - | | `_id` | string | Refund policy id (24-character hex MongoDB ObjectId) | | `name` | string | Internal name | | `policy` | string | Policy text shown to buyers | | `period` | number | Length of the refund window | | `periodType` | string — days, weeks | | | `appliedTo` | integer | Products using this policy (`GET /refunds` only) | | `testMode` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### CheckoutSession | Field | Type | Description | | - | - | - | | `id` | string | Opaque checkout session id | | `url` | string (uri) | Hosted checkout URL on your store subdomain — redirect the buyer here | ### Webhook | Field | Type | Description | | - | - | - | | `_id` | string | Webhook id (24-character hex MongoDB ObjectId) | | `url` | string (uri) | | | `description` | string | | | `events` | array of string | | | `active` | boolean | | | `secret` | string | Signing secret. Returned by `POST /webhooks`, `GET /webhooks/{id}` and `POST /webhooks/{id}/rotate-secret` only — never by the list or update responses. | | `testMode` | boolean | Mode of the endpoint — it only receives events from that mode | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### WebhookDelivery One delivery attempt from the webhook delivery log (kept for 30 days) | Field | Type | Description | | - | - | - | | `_id` | string | Delivery id (24-character hex MongoDB ObjectId) | | `webhookId` | string | The endpoint it was sent to | | `eventId` | string | The event id (`evt_…`) — shared by retries and redeliveries | | `event` | string | | | `url` | string | Endpoint URL at the time of sending | | `webhookData` | string | The exact JSON body that was sent (a string) | | `isSuccessful` | boolean | Whether the endpoint answered 2xx | | `attempt` | integer | Attempt number (1 = first try) | | `status` | integer | HTTP status the endpoint returned, if any | | `durationMs` | integer | | | `error` | string | Failure reason, if any | | `isTest` | boolean | `true` for `POST /webhooks/{id}/test` deliveries | | `redeliveryOf` | string | The delivery this one replayed (`POST /delivered-webhooks/{id}/redeliver`) | | `sentDate` | string (date-time) | | | `deliveredAt` | string (date-time) | | | `expiresAt` | string (date-time) | When the log entry is deleted | | `testMode` | boolean | | ### WebhookEvent The JSON body of an outgoing webhook delivery (not an API response). The envelope fields sit at the top level next to the event's own fields — see the Webhook events section for headers and signature verification. | Field | Type | Description | | - | - | - | | `id` | string | Unique event id — the same value as the `X-Pocketsflow-Event-Id` header. Retries of one delivery share it. | | `type` | string — order.completed, order.refunded, product.created, product.updated, product.deleted, review\.created, customer.created, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, customer.subscription.pause, customer.subscription.resumed, customer.subscription.trial\_will\_end, invoice.created, invoice.upcoming, invoice.payment\_succeeded, invoice.payment\_failed, payment\_intent.succeeded, payment\_intent.payment\_failed, credit.granted, credit.balance\_changed, credit.auto\_refill.succeeded, credit.auto\_refill.failed, credit.consent.enabled, credit.consent.disabled | Event type — the same value as `X-Pocketsflow-Event` | | `created` | integer | When the event was created, Unix seconds | | `test` | boolean | `true` on deliveries sent by `POST /webhooks/{id}/test` | | `webhookId` | string | The endpoint this delivery was sent to (24-character hex MongoDB ObjectId) | | `clientReferenceId` | string, nullable | Echo of the `clientReferenceId` passed at checkout (order and subscription events) | | `metadata` | object | Echo of the checkout `metadata` (order and subscription events) | ### Post A newsletter post (email campaign) | Field | Type | Description | | - | - | - | | `_id` | string | Post id (24-character hex MongoDB ObjectId) | | `name` | string | | | `subject` | string | | | `preview` | string | | | `fromName` | string | | | `fromEmail` | string | Your verified sender address | | `replyToEmail` | string | | | `contentHtml` | string | | | `contentJson` | object, nullable | | | `status` | string — draft, scheduled, sending, sent, failed, automation | `draft` → `scheduled` → `sending` → `sent` (or `failed`). `automation` posts are templates sent only by automations. | | `scheduledAt` | string (date-time) | | | `scheduledTimezone` | string | | | `sentAt` | string (date-time) | | | `sentCount` | integer | Recipients the post was delivered to | | `failedCount` | integer | Recipients rejected on the last send attempt | | `failureReason` | string — SEND\_ALLOWANCE\_EXCEEDED, SELLER\_BLOCKED, EMAIL\_SENDING\_PAUSED, DAILY\_SEND\_LIMIT | Why a scheduled send was refused at delivery time (or stopped mid-send: `EMAIL_SENDING_PAUSED`) | | `sendToAll` | boolean | | | `subscriberIds` | array of string | | | `productIds` | array of string | | | `tags` | array of string | | | `source` | string — dashboard, api | `api` for emails sent with `POST /newsletters/send`, `dashboard` otherwise | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### EmailSubscriber A newsletter contact | Field | Type | Description | | - | - | - | | `_id` | string | Subscriber id (24-character hex MongoDB ObjectId) | | `email` | string | | | `name` | string | | | `status` | string — active, unsubscribed, bounced, complained | | | `tags` | array of string | | | `productIds` | array of string | Products / subscription offers this contact bought | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### CreatorPage Your Link in Bio page | Field | Type | Description | | - | - | - | | `_id` | string | Creator page id (24-character hex MongoDB ObjectId) | | `userId` | string | | | `creatorName` | string | | | `creatorBio` | string | | | `username` | string | Page username — also your store subdomain | | `profilePicture` | string | | | `coverImage` | string | | | `images` | array of string | | | `template` | string | | | `theme` | object | | | `themeV2` | object | | | `gaMeasurementId` | string | | | `socialLinks` | array of object | | | `regularLinks` | array of object | | | `selectedProductIds` | array of string | | | `selectedSubscriptionIds` | array of string | | | `catalogVisibilityConfigured` | boolean | `true` once a selection was saved — then only the selected items are shown | | `subscriberForm` | object | | | `bookingEnabled` | boolean | | | `bookingButtonLabel` | string | | | `showFirstName` | boolean | | | `showLastName` | boolean | | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### User The authenticated account. Only integrator-relevant fields are listed; other dashboard-internal fields may appear and can change without notice — don't rely on them. | Field | Type | Description | | - | - | - | | `_id` | string | Account record id (24-character hex MongoDB ObjectId) | | `userId` | string | Stable account id (owner of every resource) | | `email` | string (email) | | | `name` | string | | | `firstName` | string | | | `lastName` | string | | | `creatorName` | string | Store name | | `subdomain` | string | Store subdomain — build storefront and product URLs as `https://{subdomain}.pocketsflow.com/…`. Required before `POST /checkout/sessions` works. | | `currency` | string | Account currency — product prices are stored in it | | `country` | string | | | `testMode` | boolean | With an API key: the key's mode (`true` for `pk_test_…`). With a dashboard session: the dashboard toggle. | | `canSell` | boolean | Whether the account may currently take payments. `false` while selling is paused. | | `hasSales` | boolean | Whether the account has any sale | | `createdFirstProduct` | boolean | | | `statementDescriptor` | string | The store name buyers see on their card statement | | `picture` | string | Avatar URL | | `currentPlan` | string — free, tier1, tier2, tier3, tier4 | Newsletter plan | | `createdAt` | string (date-time) | | | `updatedAt` | string (date-time) | | ### Pagination | Field | Type | Description | | - | - | - | | `totalCount` | integer | | | `totalPages` | integer | | | `currentPage` | integer | | | `pageSize` | integer | | | `hasMore` | boolean | Whether `currentPage + 1` has results | ### Error Error body. Most endpoints set `message`; authentication errors set both `error` and `message`; some add a machine-readable `code`. Read `message` first and fall back to `error`. | Field | Type | Description | | - | - | - | | `message` | string | Human-readable explanation | | `error` | string | Short error title (authentication errors) or, on a few endpoints, a machine-readable code such as `PLAN_LIMIT_EXCEEDED` | | `code` | string | Machine-readable error code when present, e.g. `COUNTRY_RESTRICTED`, `ACCOUNT_BLOCKED`, `ACCOUNT_DELETED`, `SEND_ALLOWANCE_EXCEEDED` | ## Need a typed client? Use the [Pocketsflow Node.js SDK](/api-reference/sdk) for typed server-side calls, or import [`/docs.json`](https://api.pocketsflow.com/docs.json) into your preferred OpenAPI generator. # Post-purchase offers & social proof Source: https://docs.pocketsflow.com/api-reference/growth-checkout Configure a product's one-click post-purchase offer and its checkout social proof with your API key or the MCP server. Both settings live on a product and need the **Growth** plan (or higher) to turn on. Turning them off and reading them is never gated. A call that turns one on below Growth answers `403` with `code: "FEATURE_LOCKED"`: ```json theme={"system"} { "error": "FEATURE_LOCKED", "code": "FEATURE_LOCKED", "upgradeRequired": true, "message": "This feature is part of a higher plan. Please upgrade your plan to use it.", "details": { "feature": "socialProof", "requiredPlan": "tier2", "requiredPlanName": "Growth" } } ``` ## Post-purchase offer | Method | Path | MCP tool | | - | - | - | | `GET` | `/post-purchase/products/{id}` | `get_post_purchase_offer` | | `PUT` | `/post-purchase/products/{id}` | `update_post_purchase_offer` | `{id}` is the product buyers purchase first. Fields you leave out of a `PUT` keep their value. ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/post-purchase/products/665f1c2a9b3e4a0012ab34cd \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "productId": "665f1c2a9b3e4a0012ab34ce", "discountPercent": 20 }' ``` ```json theme={"system"} { "postPurchaseOffer": { "enabled": true, "productId": "665f1c2a9b3e4a0012ab34ce", "discountPercent": 20 } } ``` | Field | Type | Notes | | - | - | - | | `enabled` | boolean | Show the offer after checkout. Needs `productId`. | | `productId` | string | Another fixed-price, one-time product of yours, same mode (live/test). | | `discountPercent` | integer | 0-90. The price after it must be at least 1.00. | A `400` carries a `code` saying what is wrong with the offered product: `same_product`, `other_mode`, `pay_what_you_want`, `credits`, `not_available`, `checkout_disabled` or `too_cheap`. When a buyer accepts, you receive `order.completed` for the new order (like any order) and [`order.post_purchase_accepted`](/api-webhooks/events) with `parentOrder.id`, the order it followed. ## Social proof | Method | Path | Auth | MCP tool | | - | - | - | - | | `GET` | `/social-proof/products/{id}/settings` | API key | `get_social_proof_settings` | | `PUT` | `/social-proof/products/{id}/settings` | API key | `update_social_proof_settings` | | `GET` | `/social-proof/products/{id}` | Public | `get_social_proof` | ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/social-proof/products/665f1c2a9b3e4a0012ab34cd/settings \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "countWindow": "7d", "threshold": 5 }' ``` | Field | Type | Notes | | - | - | - | | `enabled` | boolean | Show social proof at checkout. | | `purchaseCount` | boolean | "N people bought this in the last 24 hours / 7 days". | | `countWindow` | `"24h"` \| `"7d"` | The window the count covers. | | `threshold` | integer | 1-1000, default 3. Below it, no count and no notice. | | `recentPurchases` | boolean | "Someone in Lyon bought this · 2h ago". | | `rating` | boolean | Average review rating. | The public read returns aggregates only (cached about 60 seconds), the same numbers the checkout shows: ```json theme={"system"} { "enabled": true, "purchases": { "count": 14, "window": "24h" }, "recent": { "place": "Lyon", "placeKind": "city", "minutesAgo": 120 }, "rating": { "average": 4.8, "count": 15 } } ``` Counts include live, non-refunded orders only. `recent.place` is a city when the payment recorded one, otherwise a two-letter country code. `enabled` is `false` (and every other field `null`) when the setting is off or your plan no longer includes it. # API reference Source: https://docs.pocketsflow.com/api-reference/introduction The Pocketsflow HTTP API — base URL, authentication, conventions, and links to the complete endpoint catalog. The Pocketsflow HTTP API lets you manage products, checkout, orders, payments, subscribers, customers, discounts, upsells, refunds, webhooks, newsletters, your Link in Bio page, images, and the partner program — all from your own systems. > [card] [Open the interactive API reference](https://api.pocketsflow.com/docs) > > Browse every endpoint, see request/response schemas, and try calls live at > **api.pocketsflow\.com/docs**. > [card] [Browse every public endpoint](/api-reference/endpoints) > > See all public paths, methods, parameters, request bodies, and response codes > generated from the OpenAPI contract. The raw OpenAPI specification is served at [`https://api.pocketsflow.com/docs.json`](https://api.pocketsflow.com/docs.json) — import it into Postman/Insomnia or generate a typed client from it. ## Base URL Every request is made over HTTPS to: ``` https://api.pocketsflow.com ``` There is no version prefix in the path — endpoints are addressed directly (for example `GET /orders`). See [Versioning](#versioning) for how the API changes. ## Authentication Every endpoint requires authentication via the `Authorization` header using the **Bearer** scheme, except the few marked **public** below (they are used by the hosted checkout). Two credential types are accepted: | Credential | Format | Typical use | | - | - | - | | **API key** | `pk_live_…` / `pk_test_…` | Server-to-server integrations, scripts, agents. | | **Auth0 JWT** | `Bearer eyJ…` | First-party dashboard / session-based calls. | Create an API key in the dashboard under **Developers → API keys**, then send it on every request: ```bash theme={"system"} curl https://api.pocketsflow.com/users/me \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` | Prefix | Mode | Data | | - | - | - | | `pk_live_…` | Live | Real products, customers, payments, and payouts. | | `pk_test_…` | Test | Sandbox data for development — never charges a real card. | All data is automatically scoped to the account that owns the key — you never pass a user id. **The key decides the mode:** a `pk_test_…` key always reads and writes test-mode data and a `pk_live_…` key always live data, whatever the test-mode toggle in the dashboard says: lists and searches return that mode's data and anything you create lands in it. `GET /users/me` reports the key's mode as `testMode`. Reads and updates by id act on your own items in either mode, so keep test and live ids apart in your integration. Keys are stored hashed, can be given an expiry, and can be archived/revoked at any time; a revoked or expired key returns `401`. Accounts in a country the API does not serve receive `403` with `"code": "COUNTRY_RESTRICTED"`. > [!WARNING] > > Treat secret API keys like passwords. Never expose them in client-side code, > public repositories, or URLs. Prefer a dedicated, revocable key per > integration, and rotate a key immediately if it leaks. ### Authentication errors Missing or malformed credentials return `401` with a JSON body: ```json theme={"system"} { "error": "Invalid API key", "message": "The provided API key is invalid, inactive, or has been archived" } ``` Common cases: no `Authorization` header, a header that doesn't start with `Bearer `, an empty token, and an inactive/archived/expired key. ## Making requests * Send JSON bodies with `Content-Type: application/json`. `POST /images` takes `multipart/form-data`, and the product and Link in Bio write endpoints also accept `multipart/form-data` when you upload files. * Responses are JSON. IDs are Mongo ObjectId strings (24 hex characters) unless noted (payment-processor ids are `plan_…`, `pay_…`, `mem_…`). * Timestamps are ISO 8601 UTC strings (`2026-01-24T05:35:38.103Z`). * Money in API requests and responses is a decimal amount in **major currency units** (e.g. `12.1` = \$12.10) — product prices, orders, payments, subscribers, discounts, upsells. Only fields whose name ends in `Cents` are integer cents. Webhook payloads have their own rules — see [Webhook events](/api-webhooks/events). ## Pagination List endpoints paginate in one of the following ways. | Style | Endpoints | Query params | Response envelope | | - | - | - | - | | Page-based | `/orders`, `/payments`, `/delivered-webhooks`, `/subscriptions/subscribers` | `page` (default `1`), `pageSize` (default `20`; maximum `100`) | `{ , pagination }` | | Page + limit | `/partners/referrals`, `/partners/referrals/sales` | `page` (default `1`), `limit` (default `20`, maximum `100`) | `{ data, pagination: { currentPage, totalPages, totalItems, hasNextPage, hasPrevPage, limit } }` | | None | every other list (`/products`, `/customers`, `/reviews`, `/discounts`, `/newsletters/posts`, …) | — | full array in one response | Keep requesting `page + 1` while `hasMore` is `true`. The page-based `pagination` object looks like: ```json theme={"system"} { "totalCount": 137, "totalPages": 7, "currentPage": 1, "pageSize": 20, "hasMore": true } ``` ## Errors Errors use standard HTTP status codes and a JSON body. Most endpoints return a `message`: ```json theme={"system"} { "message": "Product not found" } ``` Authentication failures return both `error` and `message`, and some errors add a machine-readable `code` (for example `COUNTRY_RESTRICTED`, `ACCOUNT_BLOCKED`, `ACCOUNT_DELETED`, `SEND_ALLOWANCE_EXCEEDED`, `EMAIL_SENDING_PAUSED`, `DAILY_SEND_LIMIT`): ```json theme={"system"} { "error": "Country not supported", "message": "The API is not available for accounts in your country. Contact support.", "code": "COUNTRY_RESTRICTED" } ``` Read `message` first, fall back to `error`, and branch on `code` when it is present. A few older endpoints answer validation errors with a plain-text body. | Status | Meaning | | - | - | | `200` / `201` | Success. | | `400` | Invalid request — malformed JSON, an invalid id, or a failed validation. | | `401` | Missing, malformed, expired, or revoked credentials. | | `402` | A plan allowance would be exceeded (newsletter sends). | | `403` | Authenticated but not permitted (restricted account, unverified email sender, plan limit, or `FEATURE_LOCKED`). | | `404` | Not found, not owned by you, or from the other test/live mode. | | `409` | Conflict (e.g. already a partner). | | `410` | The account was deleted. | | `429` | Rate limit exceeded — wait `Retry-After` seconds. | | `500` / `502` | Server-side or upstream error — safe to retry reads with backoff. | ### Plan features (`FEATURE_LOCKED`) Some features need a paid plan: custom domains, premium templates and ad pixels (Starter), upsells, abandoned checkout recovery and affiliates (Growth). A request that would turn one on when the account's plan does not include it answers `403`: ```json theme={"system"} { "error": "FEATURE_LOCKED", "code": "FEATURE_LOCKED", "upgradeRequired": true, "message": "This feature is part of a higher plan. Please upgrade your plan to use it.", "details": { "feature": "upsells", "currentPlan": "free", "requiredPlan": "tier2", "requiredPlanName": "Growth", "requiredPlanPrice": 49, "upgradeRequired": true } } ``` Nothing is saved and retrying fails the same way: send the creator to [app.pocketsflow.com/profile/billing](https://app.pocketsflow.com/profile/billing). Call `GET /users/entitlements` before you write to avoid it. See [Plans and limits](/concepts/plans-and-limits). ## Rate limits Requests authenticated with a valid API key get **600 requests per minute per account**. Unauthenticated traffic (public endpoints, or a request whose key is rejected) shares **200 requests per minute per IP address**, so always send your key. Responses carry `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` (seconds until the window resets) and `RateLimit-Policy` headers. Exceeding a limit returns `429` with a `Retry-After` header (seconds) and a JSON body: ```json theme={"system"} { "message": "Too many requests for this account, please try again later.", "retryAfter": 60 } ``` Back off and retry after that delay. Beyond that, use reasonable concurrency, back off on `5xx`, and cache where you can. Some endpoints have their own caps — for example [`POST /newsletters/send`](/api-reference/send-email) accepts at most **100 recipients** per request. ## Versioning The API is unversioned — there is no version prefix in the path. Changes are additive: new endpoints, optional request fields, response fields, and webhook event types can appear at any time, so ignore fields you don't recognise and never depend on field order. Breaking changes are announced in the [changelog](https://www.pocketsflow.com/changelog) before they ship. ## Endpoint catalog Everything below is available with an API key (a few endpoints are public and say so). Full request/response schemas live in the [interactive reference](https://api.pocketsflow.com/docs) and the [endpoint reference](/api-reference/endpoints); the most important response shapes are shown here. ### Products | Method | Path | Description | | - | - | - | | `GET` | `/products` | List all products. | | `POST` | `/products` | Create a product. Requires `name`; `price` defaults to `0` (free). | | `GET` | `/products/{id}` | Get a product by id. | | `POST` | `/products/update/{id}` | Update a product — send only the fields to change. | | `POST` | `/products/copy/{id}` | Copy a catalog item — a one-time product or a subscription offer (whichever owns the id). | | `DELETE` | `/products/{id}` | Delete a product. | | `PATCH` | `/products/{id}/abandoned-checkout` | Turn abandoned checkout recovery on or off (`{ "enabled": true }`). Turning it on needs Growth. | `POST /products` accepts (among others) `name`, `price`, `compareAtPrice`, `description`, `subtitle`, `published` (new products are created published unless you send `published: false`, which creates a draft; send `false` on update to unpublish), `slug`, `thumbnail`, `images[]`, `hasProductPage` (`"yes"` or `"no"`), `payWant`, `minPrice`, `maxPrice`, `showSales`, `showReviews`, `refundPolicy`, `hasFirstName`, `hasLastName`, and `productType`. * Prices are decimal amounts in your account currency (`currency` on `GET /users/me`), not cents. `compareAtPrice` is the crossed-out "was" price — display only, it never changes what the buyer pays. * `refundPolicy` is the **id** of one of your refund policies (from `POST /refunds`), not the policy text. * Pay-what-you-want products need a product page: a request that sets `payWant: true` must also send `hasProductPage: "yes"`, otherwise it fails with `400`. * Subscription (recurring) offers are a separate resource: fetch them with `GET /subscriptions/{id}` and delete them with `DELETE /subscriptions/{id}`. Updating a subscription offer is not available with an API key yet. `POST /products/copy/{id}` duplicates one of your catalog items. Send `{ "testMode": false }` to copy a test-mode offer into live mode ("Copy to live"); omit the body to copy within the same mode. The copy gets a deduplicated `Name (Copy)` name and starts **unpublished** when copied into live mode, so nothing can be charged before you review it. A copied one-time product fires the `product.created` webhook against the copy's own mode. ### Checkout | Method | Path | Description | | - | - | - | | `POST` | `/checkout/sessions` | Create a hosted checkout session and redirect the buyer to pay. | | `GET` | `/checkout/abandoned/summary` | Live checkouts lost over the last 30 days: `{ count, amountUsd, windowDays }`. Every plan. | ```bash theme={"system"} curl https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_live_xxxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "665f1c2a9b3e4a0012ab34cd", "successUrl": "https://acme.com/thanks", "cancelUrl": "https://acme.com/pricing", "customerEmail": "buyer@example.com", "discountCode": "LAUNCH20" }' ``` ```json theme={"system"} { "id": "cs_3f2a9c0d1e2b4a5f6789abcdef0123456789abcdef012345", "url": "https://acme.pocketsflow.com/checkout?productId=665f1c2a9b3e4a0012ab34cd&checkout_session_id=cs_3f2a9c0d1e2b4a5f6789abcdef0123456789abcdef012345&customerEmail=buyer%40example.com&discount=LAUNCH20&successUrl=https%3A%2F%2Facme.com%2Fthanks&cancelUrl=https%3A%2F%2Facme.com%2Fpricing" } ``` Required: `productId` (a product **or** subscription offer id). Optional: `successUrl` and `cancelUrl` (absolute `http(s)` URLs), `customerEmail`, `lockEmail`, `clientReferenceId` (max 256 characters), `discountCode`, and `metadata` (an object, echoed back on the resulting webhooks). Invalid values return `400`; a `productId` that is not yours returns `404`. Your account needs a store `subdomain` first — the checkout link lives on it. ### Orders | Method | Path | Description | | - | - | - | | `GET` | `/orders` | List one-time orders, newest first. Filters: `startDate` + `endDate` (together; an unparseable date is `400`), `productId`, `page`, `pageSize` (max `100`). | | `GET` | `/orders/{id}` | Get an order by id. | | `GET` | `/orders/subscriptions/{id}` | Get a subscriber with its subscription offer, customer, live `status`, and full `payments` history. `{id}` is the SubscriptionCustomer `_id`. | ```json theme={"system"} { "orders": [ { "_id": "6a43ce05fae6c4f0cb5a2193", "buyerEmail": "buyer@example.com", "gross": 12.1, "net": 8.46, "taxes": 2.1, "createdAt": "2026-01-24T05:35:38.103Z", "product": { "_id": "665f1c2a9b3e4a0012ab34cd", "name": "Starter Kit" }, "customer": { "_id": "665f1c2a9b3e4a0012abaa11", "buyerEmail": "buyer@example.com" } } ], "pagination": { "totalCount": 42, "totalPages": 3, "currentPage": 1, "pageSize": 20, "hasMore": true } } ``` ### Payments The unified payment ledger — **one-time product purchases and subscription charges (initial + every renewal)** in a single resource. Every payment is a `Sale`. | Method | Path | Description | | - | - | - | | `GET` | `/payments` | List payments. Filters: `type` (`one_time` \| `subscription` \| `all`), `startDate`, `endDate`, `productId`, `subscriptionId`, `page`, `pageSize` (max `100`). | | `GET` | `/payments/{id}` | Get a payment by id. Pass `?live=true` to also fetch the authoritative live payment from the payment processor as `paymentsPartnerLive`. | A single **Payment** object: ```json theme={"system"} { "_id": "665f1c2a9b3e4a0012ab34cd", "isSubscription": true, "billingReason": "renewal", "amount": 12.1, "grossAmount": 12.1, "amountBeforeTax": 10, "taxAmount": 2.1, "currency": "usd", "buyerEmail": "buyer@example.com", "firstName": "Jane", "lastName": "Buyer", "isRefunded": false, "isDisputed": false, "productId": "", "subscriptionId": "665f1c2a9b3e4a0012ab7788", "partnerPaymentId": "pay_rehv02B3gdIZT0", "partnerPlanId": "plan_vlD50mPbsqJLp", "membershipId": "mem_UCTD32gDLGTgb", "createdAt": "2026-01-24T05:35:38.103Z" } ``` **isSubscription** `boolean` `true` for subscription payments (initial + renewals); `false` for one-time product purchases. **billingReason** `string` Present only on subscription payments: `initial` for the first charge that activates the membership, `renewal` for every recurring charge after it. **productId** `string` Set on one-time purchases; empty on subscription payments (use `subscriptionId` instead). **partnerPaymentId / partnerPlanId / membershipId** `string` The payments partner's receipt, plan, and membership ids backing the sale. `membershipId` is present on subscription payments only and matches the subscriber's `membershipId`. > [!NOTE] > > Some responses also carry older duplicate keys for these ids and for the > `paymentsPartner`, `paymentsPartnerLive` and `membership` blocks below, with > the same values. They are deprecated and will only be removed after notice — > read the names documented here. `GET /payments` returns `{ payments: [Payment], pagination }`. `GET /payments/{id}?live=true` returns a **PaymentDetail**: ```json theme={"system"} { "payment": { "_id": "665f1c2a9b3e4a0012ab34cd", "isSubscription": true, "billingReason": "renewal", "amount": 12.1, "amountBeforeTax": 10, "taxAmount": 2.1, "currency": "usd", "net": 8.46, "fee": 0.94, "metadata": { "id": "pay_rehv02B3gdIZT0", "status": "paid", "...": "raw stored processor payload" } }, "product": null, "subscription": { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "price": 29, "frequency": "monthly" }, "customer": { "_id": "665f1c2a9b3e4a0012abaa11", "buyerEmail": "buyer@example.com" }, "paymentsPartner": { "id": "pay_rehv02B3gdIZT0", "total": 12.1, "subtotal": 10 }, "paymentsPartnerLive": { "id": "pay_rehv02B3gdIZT0", "status": "paid", "amount_after_fees": 8.46 } } ``` `net` = `amountBeforeTax − affiliateCut − processingFee`; `fee` is the processor fee. `paymentsPartnerLive` is `null` if the live lookup failed — the stored `paymentsPartner` block still applies, so `?live=true` never fails the request. > [!NOTE] > > The total transaction cost on a sale is itemized — currently an estimated > **4.7% + \$0.30** (about **\$5.00** on \$100), covering the Pocketsflow platform, > payment infrastructure, tax handling when required, and dispute prevention. > The **order detail is authoritative**: it uses the settled payment and returns > the platform fee, processing fee, total transaction cost, effective fee rate, > and net amount. See [Pricing & fees](/payments/fees). ### Subscriptions and subscribers Two distinct concepts: a **subscription offer** is the recurring product you sell; a **subscriber** is a buyer's membership in one of those offers. | Method | Path | Description | | - | - | - | | `POST` | `/subscriptions` | Create a subscription **offer**. Requires `name`, `price`, and `frequency` (`weekly`, `monthly`, or `yearly`). | | `GET` | `/subscriptions` | List your subscription **offers**. | | `GET` | `/subscriptions/{id}` | Get a subscription **offer** by id. | | `DELETE` | `/subscriptions/{id}` | Delete a subscription **offer** (existing subscribers are not cancelled). | | `GET` | `/subscriptions/subscribers` | List **subscribers**. Filters: `status` (one of the statuses below), `buyerEmail` (alias `email`), `subscriptionId` — a single value each, otherwise `400`; `page`, `pageSize`. | | `GET` | `/subscriptions/subscribers/{id}` | Get a subscriber + `subscription`, `customer`, live `status`, and full `payments` history. `?live=true` adds the live membership from the payment processor as `membership`. | | `POST` | `/subscriptions/{id}/cancel` | Cancel at the end of the current billing period (access continues until then). `{id}` is the subscriber `_id` or membership id (`mem_…`). | | `POST` | `/subscriptions/{id}/pause` | Pause collection; the buyer keeps access. `{id}` is the subscriber `_id` or `mem_…`. | | `POST` | `/subscriptions/{id}/resume` | Restart collection on a paused subscriber, or undo a pending cancel-at-period-end. `{id}` is the subscriber `_id` or `mem_…`. | > [!NOTE] > > Each subscriber carries a `portalUrl` — the hosted self-service portal where > the buyer manages, cancels, or resumes their subscription. The same link is > delivered as `portalUrl` in the `customer.subscription.created` / `.updated` > webhooks. Send it to that buyer **exactly as returned**: its `?token=…` is > what allows cancel/resume — a portal link built by hand from the two ids > opens read-only. > [!NOTE] > > Subscription offer creation and `/subscriptions/{id}` accept both an API key > and an Auth0 JWT. In SDK v1.2.0 and later, Node.js and TypeScript users can > call `pocketsflow.subscriptionOffers.create()`. See the [SDK > guide](/api-reference/sdk) for installation and usage; use the REST request > above if your installed SDK predates v1.2.0. A **Subscriber** object carries a processor-sourced live `status` (`incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, `succeeded`, `refunded`, `paused`) and the joined offer: ```json theme={"system"} { "_id": "665f1c2a9b3e4a0012abccdd", "buyerEmail": "buyer@example.com", "status": "active", "active": true, "partnerPlanId": "plan_vlD50mPbsqJLp", "membershipId": "mem_UCTD32gDLGTgb", "cancelAtPeriodEnd": false, "portalUrl": "https://app.pocketsflow.com/portal/665f1c2a9b3e4a0012ab7788/665f1c2a9b3e4a0012abccdd?token=9f2c…", "subscriptionId": "665f1c2a9b3e4a0012ab7788", "firstName": "Jane", "lastName": "Buyer", "country": "NL", "createdAt": "2026-01-24T05:35:38.103Z", "subscription": { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "price": 29, "frequency": "monthly" } } ``` `GET /subscriptions/subscribers/{id}?live=true`: ```json theme={"system"} { "subscriber": { "_id": "665f1c2a9b3e4a0012abccdd", "status": "active", "buyerEmail": "buyer@example.com" }, "subscription": { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "price": 29, "frequency": "monthly" }, "customer": { "_id": "665f1c2a9b3e4a0012abaa11", "buyerEmail": "buyer@example.com" }, "status": "active", "payments": [ { "_id": "665f...01", "billingReason": "initial", "amount": 29, "createdAt": "2026-05-24T10:00:00.000Z" }, { "_id": "665f...02", "billingReason": "renewal", "amount": 29, "createdAt": "2026-06-24T10:00:00.000Z" } ], "membership": { "id": "mem_UCTD32gDLGTgb", "status": "active", "valid": true } } ``` ### Discounts | Method | Path | Description | | - | - | - | | `GET` | `/discounts` | List discounts. | | `POST` | `/discounts` | Create a discount. Requires `name`, `code`, `value`, `mainProductIds`. | | `GET` | `/discounts/{id}` | Get a discount by id. | | `POST` | `/discounts/{id}` | Update a discount — only the fields you send change. | | `DELETE` | `/discounts/{id}` | Delete a discount. | | `GET` | `/discounts/apply/{discountCode}/{productId}` | Public (no API key) — validate a code against a product; returns the discount or `404`. | | `GET` | `/discounts/check-product/{productId}` | Public (no API key) — returns `true`/`false` whether any discount targets the product. | `valueType` is `percentage` (default, `value` at most 100) or `fixed` (a decimal amount off in your account currency); `value` must be greater than 0. Optional `active` and `expiration` (an ISO 8601 date after which checkout rejects the code; `null` removes it). `mainProductIds` must all be your own products or subscription offers in the key's mode, otherwise `400`. ### Upsells | Method | Path | Description | | - | - | - | | `GET` | `/upsells` | List upsells. | | `POST` | `/upsells` | Create an upsell. Requires `mainProductIds`, `upsellProductId`, `upsellPrice`. Needs Growth. | | `GET` | `/upsells/{id}` | Get an upsell by id. | | `POST` | `/upsells/{id}` | Update an upsell (full update — send every field you want to keep). | | `DELETE` | `/upsells/{id}` | Delete an upsell. | Optional: `name`, `offer`, `compareAtPrice`, `upsellDescription`, `primaryButtonText`, `secondaryButtonText`, `active`, and the colour/font overrides. `upsellProductId` must be one of your products and `mainProductIds` your own products in the key's mode. On update, `upsellProductId`, `upsellPrice`, and `mainProductIds` change only when sent; the other fields are written as sent. `GET /upsells` returns `{ upsells, salesWithUpsells }`. ### Refunds | Method | Path | Description | | - | - | - | | `POST` | `/refunds` | Create a refund policy: `name`, `policy` (text shown to buyers), `period`, `periodType` (`days`/`weeks`). | | `GET` | `/refunds` | List refund policies, each with `appliedTo` (number of products using it). | | `GET` | `/refunds/{id}` | Public (no API key) — get a refund policy by id. | | `POST` | `/refunds/{id}` | Update a refund policy (only the fields you send; `404` if it isn't yours). | | `DELETE` | `/refunds/{id}` | Delete a refund policy. | These endpoints manage refund **policies** — the refund terms shown to buyers at checkout, which products reference by id (`refundPolicy`). They do not refund payments: refunding a payment is done from the dashboard and has no API-key endpoint. Refunds that happen arrive as the `order.refunded` webhook and as `isRefunded: true` on the payment. ### Reviews | Method | Path | Description | | - | - | - | | `GET` | `/reviews` | List all your product reviews, newest first (no filters). | ### Webhooks | Method | Path | Description | | - | - | - | | `GET` | `/webhooks` | List webhook endpoints (secrets omitted). | | `POST` | `/webhooks` | Create a webhook. Requires `url` (HTTPS) and a non-empty `events[]` of known event types; `description` max 500 characters. Returns the signing `secret`. | | `GET` | `/webhooks/{id}` | Get a webhook by id (includes its signing `secret`). | | `PATCH` | `/webhooks/{id}` | Update `url`, `events`, `description`, or `active` (response omits the secret). | | `DELETE` | `/webhooks/{id}` | Delete a webhook (`404` if it isn't yours). | | `POST` | `/webhooks/{id}/rotate-secret` | Replace the signing secret. Returns `{ id, secret }`. | | `POST` | `/webhooks/{id}/test` | Send a sample event (`test: true`) to this endpoint only and return the outcome (`delivered`, `status`, `durationMs`, `eventId`, `deliveryId`). | | `GET` | `/delivered-webhooks` | The delivery log, newest first. Filters: `webhookId`, `event`, `page`, `pageSize` (max `100`). Entries are kept 30 days. | | `GET` | `/delivered-webhooks/{id}` | One delivery, including the exact body sent (`webhookData`). | | `POST` | `/delivered-webhooks/{id}/redeliver` | Send a logged delivery to its endpoint again. | Deliveries are signed (`X-Pocketsflow-Signature-V2: t=,v1=` plus the legacy `X-Pocketsflow-Signature`), carry the event id in `X-Pocketsflow-Event-Id` and the body's `id`, and are retried up to 4 attempts on `5xx`, `429`, timeouts, and connections that never reached your endpoint. See [Webhook events](/api-webhooks/events) for the full event list, payloads, and headers, and [Authentication & security](/api-webhooks/authentication-and-security) for signature verification. ### Newsletters | Method | Path | Description | | - | - | - | | `GET` | `/newsletters/posts` | List posts, newest first. Optional filter: `status`. | | `POST` | `/newsletters/posts` | Create a post. Requires `name`. | | `GET` | `/newsletters/posts/{id}` | Get a post by id. | | `POST` | `/newsletters/posts/{id}` | Update a post — only the fields you send (sent posts can no longer be edited). | | `DELETE` | `/newsletters/posts/{id}` | Delete a post (unschedules it first). | | `POST` | `/newsletters/posts/{id}/send` | Queue the post for immediate delivery to its audience. | | `POST` | `/newsletters/send` | Send a one-off email to up to 100 recipients. See [Send email](/api-reference/send-email). | | `GET` | `/newsletters/audiences` | List product audiences (buyers and contacts per product). | | `POST` | `/newsletters/audiences/sync` | Add a product's buyers (or all buyers) to your contacts. | | `GET` | `/newsletters/subscribers` | List newsletter subscribers (filter: `productId`). | | `GET` | `/newsletters/subscribers/{id}` | Get a subscriber by id. | | `DELETE` | `/newsletters/subscribers/{id}` | Remove a subscriber. | A **post** has a `name` (internal, required), `subject`, `preview` (inbox preview text), `contentHtml` (the email body; `contentJson` is the optional editor document), and an audience: `sendToAll`, `subscriberIds`, `productIds` (everyone who bought those products), and/or `tags`. The sender (`fromName`, `replyToEmail`) defaults to your newsletter settings, which must be configured first. `status` is `draft` (default), `scheduled`, `sending`, `sent`, `failed`, or `automation`; you can set `draft`, `scheduled` (with `scheduledAt` and optional `scheduledTimezone`), or `automation`. Any status other than `draft`/`automation` needs `subject`, `preview`, `fromName`, and `contentHtml`. ```bash theme={"system"} curl https://api.pocketsflow.com/newsletters/posts \ -H "Authorization: Bearer pk_live_xxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "June product update", "subject": "New in June", "preview": "Three new templates", "contentHtml": "

Hi there — here is what is new.

", "sendToAll": true }' ``` Then send it with `POST /newsletters/posts/{id}/send`, which answers `{ "message": "Post queued for sending", "post": { … } }`. Sending requires a verified sender email (`400` otherwise); exceeding your monthly send allowance returns `402` (`code: "SEND_ALLOWANCE_EXCEEDED"`), and a restricted account, a paused sender (`EMAIL_SENDING_PAUSED`) or an over-limit subscriber count returns `403`. New accounts can send up to 1,000 emails a day (`429`, `code: "DAILY_SEND_LIMIT"`); see [Deliverability protection](/api-reference/send-email#deliverability-protection). ### Link in Bio (creator pages) | Method | Path | Description | | - | - | - | | `GET` | `/creator-pages` | Get your Link in Bio page (`404` if you have none). | | `POST` | `/creator-pages` | **Create** your page. Requires `username`. Returns `400` if you already have one. | | `PUT` | `/creator-pages` | **Update** your page — only the fields you send change. | | `DELETE` | `/creator-pages` | Delete your page. | | `PATCH` | `/creator-pages/username` | Change only the username (`{ "username": "acme" }`). | | `GET` | `/creator-pages/check-username/{username}` | Check whether a username is available. | Page fields: `creatorName`, `creatorBio`, `username` (3–30 letters, numbers, `-` or `_`; it is also your store subdomain), `socialLinks` and `regularLinks` (arrays of `{ name, url, customName? }`, at most 20 each — the whole array is replaced on update), `profilePicture`, `coverImage`, `images`, `template`, `themeV2`, `gaMeasurementId`, `selectedProductIds` / `selectedSubscriptionIds` (which of your products the page shows), `subscriberForm`, `bookingEnabled`, `showFirstName`, and `showLastName`. There are no per-link endpoints: to add, edit, or remove a link, send the full `regularLinks` array with `PUT /creator-pages`. ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/creator-pages \ -H "Authorization: Bearer pk_live_xxxx" \ -H "Content-Type: application/json" \ -d '{ "creatorBio": "Templates for busy founders.", "regularLinks": [ { "name": "Free guide", "url": "https://acme.com/guide" }, { "name": "Course", "url": "https://acme.com/course" } ] }' ``` ### Images | Method | Path | Description | | - | - | - | | `POST` | `/images` | Upload an image (`multipart/form-data`, field `image`). Returns `{ imageUrl }`. A missing file or unexpected field name returns `400`; anything but PNG, JPEG, GIF, WebP, or AVIF (detected from the file's bytes) returns `415`. | ### Customers | Method | Path | Description | | - | - | - | | `GET` | `/customers` | List customers (full list, deduplicated by email, with `numberOfOrders`). Filter by `productId`; sort with `sortBy` (`email` \| `country` \| `numberOfOrders` \| `createdAt`) and `sortOrder` (`asc` \| `desc`). | | `GET` | `/customers/{id}` | Get a customer by id. | ### Account | Method | Path | Description | | - | - | - | | `GET` | `/users/me` | Get the authenticated account. | | `POST` | `/users/update` | Set or remove ad tracking pixels (`facebookPixel`, `googlePixel`, `tiktokPixel`, …). Adding one needs Starter. | ```json theme={"system"} { "_id": "665f1c2a9b3e4a0012ab0001", "userId": "auth0|68fd3a499605389e7305cdc1", "email": "creator@example.com", "firstName": "Jane", "lastName": "Creator", "creatorName": "Acme Studio", "subdomain": "acme", "currency": "USD", "country": "US", "testMode": false, "canSell": true, "hasSales": true, "createdFirstProduct": true, "statementDescriptor": "ACME STUDIO", "createdAt": "2026-01-24T05:35:38.103Z" } ``` Use `subdomain` to build product/checkout URLs (`https://{subdomain}.pocketsflow.com/...`). `testMode` reflects the key you called with (`true` for a `pk_test_…` key). `canSell` is `false` while selling is paused on the account. Other fields may appear in the response; they are dashboard-internal and can change without notice. A suspended account answers `403` (`code: "ACCOUNT_BLOCKED"`) and a deleted one `410` (`code: "ACCOUNT_DELETED"`). ### Plans | Method | Path | Description | | - | - | - | | `GET` | `/users/entitlements` | Your active plan, billing interval, platform fee rate, seats, and `features..allowed` for every feature key. | | `GET` | `/users/billing-tiers` | **Public.** Every plan with monthly and yearly price, fee rate, caps, seats and feature keys. | ```json theme={"system"} { "plan": "volume", "planName": "Volume", "billingInterval": "year", "feeRate": 0.01, "seats": null, "enforced": true, "features": { "upsells": { "allowed": true, "requiredPlan": "tier2", "requiredPlanName": "Growth", "reason": "plan", "grandfatheredUntil": null } } } ``` Plans are bought in the dashboard only. See [Plans and limits](/concepts/plans-and-limits). ### Partners | Method | Path | Description | | - | - | - | | `POST` | `/partners` | Become a partner. Returns your `referralCode`. | | `GET` | `/partners` | Get your partner profile. | | `POST` | `/partners/register-referral` | Record a referral signup (`referralCode`). Only accounts under 30 days old, never a self-referral. | | `GET` | `/partners/referrals` | List referred users with live sales count and USD revenue (`page`, `limit` ≤ 100). | | `GET` | `/partners/referrals/sales` | List referred users' live sales — seller, amounts, `revenueUsd`, `commission`; no buyer data (`page`, `limit` ≤ 100). | | `GET` | `/partners/stats` | Live-computed signups, sales, revenue, and commission. | ### Weekly report | Method | Path | Description | | - | - | - | | `GET` | `/users/weekly-report/preview` | Last week's growth report: revenue, sales, visits, conversion, best seller, top source and one next step, plus the rendered email. See [Weekly growth report](/operations/weekly-report). | | `GET` | `/users/weekly-report/settings` | Whether the Monday email is on, its timezone and the next send. | | `PUT` | `/users/weekly-report/settings` | Turn the Monday email on or off (`{ "enabled": false }`). | ## Connect an AI agent Prefer to drive Pocketsflow from an AI assistant? The [MCP server](/api-reference/mcp-server) exposes this entire API as Model Context Protocol tools — add `https://www.pocketsflow.com/mcp` to Claude, ChatGPT, Cursor, or your own agent, sign in, and click **Allow access**, and it can manage your account in natural language. Connecting over MCP needs no API key; the REST API and SDK keep using the API keys described above. ## Building an integration? If you're connecting Pocketsflow to an external store or platform (for example WooCommerce), start with the [Integrations](/integrations/overview) section — it walks through the end-to-end pattern with code examples. ## Related topics * [MCP server](/api-reference/mcp-server) * [Plans and limits](/concepts/plans-and-limits) * [Send email](/api-reference/send-email) * [Webhooks & API overview](/api-webhooks/overview) * [Webhook events](/api-webhooks/events) * [Authentication & security](/api-webhooks/authentication-and-security) * [Integrations overview](/integrations/overview) # Launch pricing Source: https://docs.pocketsflow.com/api-reference/launch-pricing Flash sales, fair pricing by country and early-bird price steps with your API key, and the price a buyer pays right now. Base URL `https://api.pocketsflow.com`. Authenticate with your API key (`Authorization: Bearer pk_live_…` or `pk_test_…`). Turning a feature **on** needs the Growth plan (`403 FEATURE_LOCKED` below it); turning it off, deleting and reading never do. When a store moves below Growth, its products go back to their list prices. ## How a price is worked out One rule, on our server, for the product page, the checkout, the receipt, the order and the `order.completed` webhook: 1. **Price in effect** — the lowest of the product's price (or the variant's), the early-bird step's price while a step is open, and the buyer's own personal-deadline offer. On a tie the early-bird step wins. 2. **At most one discount, the best for the buyer** — among the live flash sales, fair pricing for the buyer's country and the code they entered (a discount code or a unique coupon), taken off the price in effect. Discounts never stack with each other. Ties: the code, then the flash sale, then fair pricing. 3. **Limits** — flash sales and fair pricing never take a price under 1.00 or make an order free; a code can (a 100% code is a free order, as before). Pay-what-you-want products and subscriptions are not repriced. ## Flash sales | Method | Endpoint | Description | | - | - | - | | `GET` | `/flash-sales` | List sales (`?status=live\|scheduled\|ended`) with orders and revenue | | `POST` | `/flash-sales` | Create a sale | | `GET` | `/flash-sales/{id}` | One sale | | `PATCH` | `/flash-sales/{id}` | Change a sale (move `endsAt` to now to end it early) | | `DELETE` | `/flash-sales/{id}` | Delete a sale (orders keep their record) | | `POST` | `/flash-sales/{id}/announcement` | Draft the announcement email (nothing is sent) | ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/flash-sales \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Black Friday", "startsAt": "2026-11-27T08:00:00.000Z", "endsAt": "2026-11-30T23:59:00.000Z", "valueType": "percentage", "value": 30 }' ``` | Field | Type | Notes | | - | - | - | | `name` | string | Up to 80 characters. Shown to buyers with the countdown. | | `startsAt`, `endsAt` | ISO date | Up to 90 days apart; `endsAt` in the future. | | `valueType` | `percentage` \| `fixed` | | | `value` | number | Whole percent 1–90, or an amount in your currency. | | `productIds` | string\[] | Your products on sale. Empty or left out: the whole store. | | `allProducts` | boolean | `true` puts the whole store on sale. | The response is the sale with `status` (`scheduled`, `live`, `ended`, computed from the clock), `stats: { sales, revenue }` and `announcementPostId`. The announcement endpoint answers `{ postId, created }`: review the draft, then send or schedule it with the [newsletter endpoints](/api-reference/endpoints#posts). ## Fair pricing | Method | Endpoint | Description | | - | - | - | | `GET` | `/fair-pricing` | Settings and the tier table (every country per tier) | | `PUT` | `/fair-pricing` | Change settings (fields left out keep their value) | | `GET` | `/fair-pricing/analytics?days=30` | Orders, revenue, discount given and billing mismatches by country | | `PATCH` | `/products/{id}/fair-pricing` | A product's mode: `store`, `off` or `custom` | ```json theme={"system"} { "enabled": true, "tiers": { "t1": 20, "t2": 35, "t3": 50, "t4": 60 }, "countryOverrides": { "BR": 40, "PT": 0 } } ``` Tiers hold the countries whose prices are 58–72% (`t1`), 45–58% (`t2`), 33–45% (`t3`) and under 33% (`t4`) of US prices. A country exception wins over its tier; `0` means full price. Percents are whole numbers from 0 to 80. The buyer's country is the country of their IP, worked out on our server. The discount applies only when the browser time zone (`tz`) belongs to that country and any billing country sent at checkout is the same. After payment, the billing country collected is compared again: a mismatch is recorded on the order as `pricing.fairPricing.verified: false`. ## Early-bird price steps | Method | Endpoint | Description | | - | - | - | | `PUT` | `/products/{id}/price-steps` | Set a product's steps | | `GET` | `/products/{id}/launch-pricing` | Its steps (seats sold, the step in effect) and fair pricing mode | | `GET` | `/pricing/early-bird` | Every product with steps | ```json theme={"system"} { "enabled": true, "steps": [ { "price": 49, "maxSales": 50 }, { "price": 59, "endsAt": "2026-11-01T00:00:00.000Z" } ] } ``` Up to 5 steps, each below the product's price, with `maxSales`, `endsAt` or both; prices go up from step to step. Send back the step `id`s you received to keep their counts when you edit. Steps need a fixed price and no variants. Seats are taken atomically when a checkout starts and held for 20 minutes, so concurrent buyers never oversell a step; an unpaid seat goes back on sale. A buyer who pays after their hold expired was shown and charged the step price, so the sale is honoured and counted (a step can end one over its limit only through payments that were already in flight). ## The buyer's price (public) `GET /pricing/quote/{productId}?tz=Asia/Kolkata` — no API key, never cached. Optional `variantId`, `discountId`, `billingCountry`, `orderBumpIds`. ```json theme={"system"} { "productId": "665f1c2a9b3e4a0012ab34cd", "currency": "USD", "payWant": false, "listPrice": 79, "basePrice": 49, "price": 44.1, "applied": { "source": "flash_sale", "label": "Launch week", "valueType": "percentage", "value": 10, "amountOff": 4.9 }, "codeIgnored": false, "earlyBird": { "index": 0, "count": 2, "price": 49, "nextPrice": 59, "left": 23, "maxSales": 50, "endsAt": null }, "flashSale": { "id": "6711d4e59e3f1a0012cd8b01", "name": "Launch week", "endsAt": "2026-10-20T09:00:00.000Z", "valueType": "percentage", "value": 10, "applied": true }, "fairPricing": null } ``` Amounts are in your currency. The checkout charges this same price. Add `orderBumpIds` (comma-separated) to price the whole cart the way the checkout does: each order bump at its offer price, then the [Buy more, save more](/selling/buy-more-save-more) tier off the subtotal (not on top of a discount code unless you allow it). The answer gains `cart`: ```json theme={"system"} { "cart": { "items": [ { "productId": "665f1c2a9b3e4a0012ab34cd", "price": 39.69 }, { "productId": "665f1c2a9b3e4a0012ab34ce", "orderBumpId": "6711d4e59e3f1a0012cd8c02", "price": 26.1 } ], "subtotal": 73.1, "tieredDiscount": { "percentOff": 10, "itemCount": 2, "amount": 7.31, "settlementAmount": 7.31 }, "total": 65.79 } } ``` `total` is what the checkout charges before tax; each item's `price` is its share after the tier, as recorded on its order. ## Orders and webhooks Every order priced by these rules carries `pricing` (also in the `order.completed` webhook): ```json theme={"system"} { "pricing": { "listPrice": 79, "basePrice": 49, "price": 29.4, "amountOff": 49.6, "currency": "USD", "source": "fair_pricing", "earlyBird": { "stepId": "step_3f9a1c2b7d4e", "index": 0, "price": 49, "nextPrice": 79 }, "fairPricing": { "country": "IN", "tier": "t4", "percentOff": 40, "billingCountry": "IN", "verified": true }, "codeIgnored": false } } ``` ## Errors | Status | When | | - | - | | `400` | Invalid input, e.g. `Step 1: the price must be lower than the product's price`. | | `403` | `code: FEATURE_LOCKED` — turning it on needs the Growth plan. | | `404` | No sale or product with this id in your account. | ## MCP `list_flash_sales`, `create_flash_sale`, `get_flash_sale`, `update_flash_sale`, `delete_flash_sale`, `create_flash_sale_announcement`, `get_fair_pricing`, `update_fair_pricing`, `get_fair_pricing_analytics`, `list_price_steps`, `get_product_launch_pricing`, `set_product_price_steps`, `set_product_fair_pricing`, `get_price_quote`. # License keys Source: https://docs.pocketsflow.com/api-reference/license-keys Sell software with a license key per sale: turn keys on for a product, then validate, activate and deactivate them from your app with no secret key. Selling an app, a plugin or a desktop tool? Turn on **License keys** for the product and every sale gets its own key. The buyer sees it in their purchase receipt and in **My purchases** (with a copy button), you see it on the order, and your software checks it against three public endpoints — no API key ships inside your app. **1. Turn it on** In the product editor, open **License keys**, switch on **Generate a license key for each sale** and, optionally, set an **activation limit** (leave it blank for unlimited). **2. Sell** Each new sale of the product gets one key, like `7KQ2M-X9D4R-T3VWB-8HNPC`. It is in the buyer's receipt email, in their purchases, on the order in your dashboard and in the `order.completed` webhook. **3. Check it from your app** Call `POST /licenses/activate` when the user enters the key, and `POST /licenses/validate` on launch. > [!NOTE] > > License keys are for one-time products. Keys are issued for sales made after > you turn the setting on. A refunded or disputed order's key stops > validating automatically. ## How keys work * **Format.** Four groups of five characters (`XXXXX-XXXXX-XXXXX-XXXXX`) drawn from a cryptographically secure random source — 100 bits, so keys can't be guessed. Input is forgiving: case, spaces and dashes are ignored, and `O` is read as `0`, `I`/`L` as `1`. * **One key per order.** Payment retries never create a second key. * **Activations.** An activation is one install or device, identified by an `instanceId` you choose (or one we generate). The activation limit you set on the product is copied onto each key when it is issued, so changing the product later never takes seats away from buyers who already paid. * **Product-bound.** Every call needs the product id **and** the key. A key of another product gets the same `404` as a key that doesn't exist. ## Public endpoints (called from your software) Base URL `https://api.pocketsflow.com`. No `Authorization` header. JSON body: | Field | Required | Notes | | - | - | - | | `productId` | yes | The product the key was sold with. | | `licenseKey` | yes | What the user entered. | | `instanceId` | activate: no, deactivate: yes, validate: no | Your id for this install (1–128 letters, digits, `.`, `_`, `:`, `-`). | | `instanceName` | no | Activate only. A label you'll see on the order, e.g. the device name. | `snake_case` spellings (`product_id`, `license_key`, `instance_id`, `instance_name`) are accepted too. The same routes also answer under `/v1/licenses/...`. Every answer has the same shape — read `valid`, and `code` when it is `false`: ```json theme={"system"} { "valid": true, "status": "active", "code": null, "message": "License key is valid.", "productId": "665f1c2a9b3e4a0012ab34cd", "activations": 1, "activationLimit": 3, "activationsRemaining": 2, "buyerEmail": "a***@example.com", "createdAt": "2026-10-15T09:12:44.000Z", "testMode": false, "instance": { "id": "macbook-pro-2f9c", "name": "Anna's MacBook Pro", "createdAt": "2026-10-15T09:20:02.000Z" } } ``` | Endpoint | Success | Failures (`code`) | | - | - | - | | `POST /licenses/activate` | `201` activated, `200` already active on this `instanceId` | `403 license_disabled`, `409 activation_limit_reached`, `404 license_not_found` | | `POST /licenses/validate` | `200` with `valid: true` | `200` with `valid: false` and `license_disabled` or `instance_not_found` (when you pass `instanceId`), `404 license_not_found` | | `POST /licenses/deactivate` | `200`, the seat is free again | `404 instance_not_found` / `license_not_found` | All three return `400 invalid_request` without `productId` or `licenseKey`, and `429` (`code: rate_limited`) past **60 requests per minute per IP**. They answer any origin, so a web app can call them from the browser. ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/licenses/activate \ -H "Content-Type: application/json" \ -d '{ "productId": "665f1c2a9b3e4a0012ab34cd", "licenseKey": "7KQ2M-X9D4R-T3VWB-8HNPC", "instanceId": "macbook-pro-2f9c", "instanceName": "Anna'\''s MacBook Pro" }' ``` ```javascript Node.js theme={"system"} const PRODUCT_ID = "665f1c2a9b3e4a0012ab34cd"; async function license(action, licenseKey, instanceId) { const res = await fetch(`https://api.pocketsflow.com/licenses/${action}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ productId: PRODUCT_ID, licenseKey, instanceId }), }); return res.json(); } // When the user enters their key: const activation = await license("activate", userKey, deviceId); if (!activation.valid) showError(activation.message); // On every launch: const check = await license("validate", savedKey, deviceId); if (!check.valid) lockApp(check.code); ``` ```python Python theme={"system"} import requests PRODUCT_ID = "665f1c2a9b3e4a0012ab34cd" def license(action, key, instance_id=None): res = requests.post( f"https://api.pocketsflow.com/licenses/{action}", json={"productId": PRODUCT_ID, "licenseKey": key, "instanceId": instance_id}, timeout=10, ) return res.json() check = license("validate", saved_key, device_id) if not check["valid"]: lock_app(check["code"]) ``` > [!TIP] > > Cache the last successful validation and allow a grace period offline — a > network error on launch shouldn't lock a paying customer out. ## Managing keys (your API key) These need your API key (`Authorization: Bearer pk_live_…` / `pk_test_…`) and only ever touch your own keys in that key's mode. | Endpoint | What it does | | - | - | | `GET /licenses` | List keys, newest first. Filters: `productId`, `orderId`, `status` (`active` / `disabled`), `email`, `page`, `pageSize` (max 100). | | `GET /licenses/{id}` | One key with its activations. | | `POST /licenses/{id}/disable` | Switch the key off. | | `POST /licenses/{id}/enable` | Switch it back on. Re-enabling the key of a refunded or disputed order is an explicit override — the order won't switch it off again. | | `POST /licenses/{id}/reset-activations` | Remove every activation, e.g. after the buyer replaced their computers. | The same actions are on the order page in your dashboard (**Orders → an order → License key**), and as MCP tools (`list_license_keys`, `get_license_key`, `disable_license_key`, `enable_license_key`, `reset_license_key_activations`). ## Refunds and disputes When an order is refunded or disputed, its key is disabled with the reason (`refunded` / `disputed`), so `validate` answers `valid: false` with `code: license_disabled` and `activate` answers `403`. The buyer's purchases no longer show the key. You can still re-enable it from the order page. Per-seat subscriptions can issue one key per subscriber (see [usage-based and per-seat pricing](/selling/usage-based-pricing)). That key is disabled with the reason `subscription_ended` while the subscription is canceled or expired, and switched back on automatically if it resumes. ## Webhooks `order.completed` for a product with license keys carries the key: ```json theme={"system"} { "licenseKey": { "id": "6710b2c49e3f1a0012cd56ef", "key": "7KQ2M-X9D4R-T3VWB-8HNPC", "status": "active", "activationLimit": 3 } } ``` See [Webhook events](/api-webhooks/events#order-completed). # MCP server Source: https://docs.pocketsflow.com/api-reference/mcp-server Connect AI agents to your Pocketsflow account with the Model Context Protocol — the full public API, exposed as MCP tools. The Pocketsflow **MCP server** exposes the same public HTTP API you see at [api.pocketsflow.com/docs](https://api.pocketsflow.com/docs) as [Model Context Protocol](https://modelcontextprotocol.io) tools. Point any MCP-capable agent, from any AI provider (Claude, ChatGPT, Cursor, VS Code, Gemini CLI, Windsurf, your own app), at it, approve the connection with your Pocketsflow login, and it can create products, read orders, set refund policies, manage webhooks, send newsletters, and more (payment refunds are issued from the dashboard) — on your behalf, scoped to your account. > [card] Endpoint > > `https://www.pocketsflow.com/mcp` — a Streamable HTTP MCP endpoint. Add the > URL to your AI app, then sign in to Pocketsflow and click **Allow access**. > No API key to create or copy. ## Authentication You don't need an API key to connect an AI app. The server speaks standard [MCP authorization](https://modelcontextprotocol.io/specification/draft/basic/authorization) (OAuth 2.1), so any client that supports it handles the sign-in for you: Claude, ChatGPT, Cursor, VS Code, Gemini CLI, Windsurf, or an agent you build with an MCP SDK. Nothing is tied to one AI vendor. **1. Add the server URL** Paste `https://www.pocketsflow.com/mcp` into your app as a remote MCP server or custom connector (see [Connect an agent](#connect-an-agent)). Leave any authentication, token, or header fields empty. **2. Sign in to Pocketsflow** When the app connects, your browser opens `app.pocketsflow.com/oauth/consent`. Sign in with your usual Pocketsflow login if asked, and check which app is asking and which account it will use. **3. Click Allow access** You're sent back to the app and the Pocketsflow tools appear. Click **Cancel** instead to refuse; nothing is created. When you click **Allow access**, Pocketsflow creates a dedicated API key for that app, named `MCP: `, in the mode your account is in at that moment (live or test; the consent screen shows a **Test mode** badge). The key itself never leaves Pocketsflow: the app only receives OAuth tokens with the `mcp:tools` scope. * **Access tokens** last one hour and are bound to `https://www.pocketsflow.com/mcp`. * **Refresh tokens** renew them automatically. Each one is single-use and rotates on every refresh; one left unused for 30 days expires, and the app asks you to sign in again. * **To disconnect** an app, delete its `MCP: …` key under **Developers → API keys**. Access stops on the next request. ### For MCP client developers Clients discover everything from the server. An unauthenticated request to `/mcp` returns `401` with `WWW-Authenticate: Bearer resource_metadata="https://api.pocketsflow.com/.well-known/oauth-protected-resource", scope="mcp:tools"`. | OAuth endpoint | URL | | - | - | | Protected resource | `https://api.pocketsflow.com/.well-known/oauth-protected-resource` | | Authorization server | `https://api.pocketsflow.com/.well-known/oauth-authorization-server` | | Dynamic registration | `POST https://api.pocketsflow.com/oauth/register` | | Authorize (PKCE `S256`) | `https://api.pocketsflow.com/oauth/authorize` | | Token | `POST https://api.pocketsflow.com/oauth/token` | Supported client styles: * **Dynamic client registration** (RFC 7591) or **Client ID Metadata Documents** (an HTTPS URL as `client_id`, MCP 2025-11-25). * **Redirect URIs**: HTTPS (web apps), `http://127.0.0.1` / `localhost` / `[::1]` on any port (CLIs, RFC 8252), and app schemes such as `cursor://` or `vscode://` (desktop apps). * **Public clients with PKCE `S256`**; `client_id` in the body or via HTTP Basic. Grant types `authorization_code` and `refresh_token`. The RFC 8707 `resource` parameter is optional; when sent it must be `https://www.pocketsflow.com/mcp`. * The sign-in request is valid for 30 minutes. After that, the consent screen asks the user to start the connection again from their AI tool. ### Alternative: API key (headless / CI) For scripts, CI jobs, server-side agents, the [`@pocketsflow/mcp`](#connect-an-agent) stdio bridge, or clients without OAuth support, you can skip the sign-in and send an API key instead. Create one under **Developers → API keys** and send it on every request: ``` Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx ``` | Prefix | Use | | - | - | | `pk_live_…` | Live mode — real products, customers, and payments. | | `pk_test_…` | Test mode — sandbox data for development. | Every tool call is executed as your account, however you connect. Deleting the key stops access immediately. > [!WARNING] > > Treat API keys like passwords. An agent connected with a `pk_live_…` key can > create and delete real data. Use a `pk_test_…` key while developing, keep > keys out of git, and prefer a dedicated, revocable key per integration. ## Connect an agent Add the server URL, then sign in and click **Allow access** when the app asks. ```text Claude custom connector theme={"system"} Customize → Connectors → Add custom connector URL: https://www.pocketsflow.com/mcp Advanced OAuth settings: leave empty Then click Connect, sign in to Pocketsflow, and click Allow access. ``` ```text ChatGPT custom connector theme={"system"} Settings → Apps & Connectors → Create (Developer Mode on) Connector URL: https://www.pocketsflow.com/mcp Authentication: OAuth Then sign in to Pocketsflow and click Allow access. ``` ```bash Claude Code CLI theme={"system"} claude mcp add --transport http pocketsflow https://www.pocketsflow.com/mcp # Then, inside Claude Code, run /mcp, pick pocketsflow, and choose Authenticate. ``` ```json Cursor (~/.cursor/mcp.json) theme={"system"} { "mcpServers": { "pocketsflow": { "url": "https://www.pocketsflow.com/mcp" } } } ``` ```json Generic mcp.json theme={"system"} { "mcpServers": { "pocketsflow": { "url": "https://www.pocketsflow.com/mcp" } } } ``` ### With an API key (headless / CI) Only for clients that can't run the sign-in, or for automation. These send the key on every request instead of signing in. ```bash Claude Code CLI theme={"system"} claude mcp add --transport http pocketsflow https://www.pocketsflow.com/mcp \ --header "Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" ``` ```json mcp.json with a header theme={"system"} { "mcpServers": { "pocketsflow": { "url": "https://www.pocketsflow.com/mcp", "headers": { "Authorization": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` ```json npx @pocketsflow/mcp (stdio) theme={"system"} { "mcpServers": { "pocketsflow": { "command": "npx", "args": ["-y", "@pocketsflow/mcp"], "env": { "POCKETSFLOW_API_KEY": "pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` Prefer the remote HTTP URL when your client supports it. Use `@pocketsflow/mcp` only for clients that speak local stdio MCP; it always authenticates with the `POCKETSFLOW_API_KEY` environment variable. ## Agent skill Install the companion skill from [skills.sh](https://skills.sh): ```bash theme={"system"} npx skills add Pocketsflow/pocketsflow-imperium@pocketsflow ``` The skill teaches agents when to use MCP tools versus the REST API, and the first-product / sales-check workflows. Once connected, the agent lists the available tools automatically. Ask it things like *"list my last 10 orders"*, *"create a \$29 product called Starter Kit"*, or *"show order ord\_123"*. Payment refunds are issued from the dashboard; the `create_refund` tools manage refund policies. For step-by-step copy-paste setup (Claude, Claude Desktop, Cursor, ChatGPT) plus an auth and first-call walkthrough, see the [MCP setup guide](/ai-tools/mcp). From **Products → Create New** in the dashboard, select an assistant under **Use your favorite AI**. The prompt includes the MCP endpoint, asks for the details of your one-time product or subscription, and requests confirmation before creating it. Claude and ChatGPT can open with the prompt prefilled; for Cursor, Grok, OpenCode, DeepSeek, GLM, and Kimi, copy the prompt and paste it into the assistant. Connect MCP first when prompted: add the server URL, then sign in and click **Allow access**. Only clients without OAuth support need an API key, and it goes in the client's MCP settings. Never paste an API key into a chat or a prompt. ## Available tools Tools mirror the public API, named `verb_resource` (for example `list_orders`, `create_product`, `cancel_subscription`). Only operations that work with API-key auth are exposed. | Area | Tools | | - | - | | Search | `search_store` ([Search API](/api-reference/search)) | | Products | `list_products`, `create_product`, `get_product`, `update_product`, `update_pricing`, `delete_product` | | Launch pricing | `list_flash_sales`, `create_flash_sale`, `get_flash_sale`, `update_flash_sale`, `delete_flash_sale`, `create_flash_sale_announcement`, `get_fair_pricing`, `update_fair_pricing`, `get_fair_pricing_analytics`, `list_price_steps`, `get_product_launch_pricing`, `set_product_price_steps`, `set_product_fair_pricing`, `get_price_quote` | | A/B tests | `list_ab_tests`, `create_ab_test`, `get_ab_test`, `get_ab_test_results`, `stop_ab_test`, `declare_ab_test_winner`, `delete_ab_test` | | Checkout | `create_checkout_session`, `get_abandoned_checkout_summary`, `set_abandoned_checkout` | | Checkout offers | `get_checkout_offers`, `update_payment_plan`, `update_exit_offer`, `get_post_purchase_offer`, `update_post_purchase_offer`, `get_social_proof_settings`, `update_social_proof_settings`, `get_social_proof` | | Upsells | `list_upsells`, `create_upsell`, `get_upsell`, `update_upsell`, `delete_upsell` | | Bundles and tiers | `list_bundles`, `get_bundle`, `update_bundle`, `delete_bundle`, `get_tiered_discounts`, `update_tiered_discounts`, `delete_tiered_discounts` | | Discounts | `list_discounts`, `create_discount`, `get_discount`, `update_discount`, `delete_discount`, `list_unique_codes`, `generate_unique_codes` | | Personal deadlines | `list_personal_deadlines`, `create_personal_deadline`, `get_personal_deadline`, `update_personal_deadline`, `delete_personal_deadline`, `list_personal_deadline_entries`, `start_personal_deadline`, `get_personal_deadline_link` | | Sales funnels | `list_funnel_templates`, `list_funnels`, `create_funnel`, `get_funnel`, `get_funnel_stats`, `activate_funnel`, `pause_funnel` | | Orders and customers | `list_orders`, `get_order`, `get_order_payment_details`, `get_order_journey`, `list_customers`, `get_customer` | | Payments and subscribers | `list_payments`, `get_payment`, `list_subscription_customers`, `get_subscription_customer` | | Payouts (read only) | `get_payout_status`, `get_payout_balance`, `list_payouts`, `get_payout` | | Customer CRM | `list_best_customers`, `get_customer_profile`, `list_customer_notes`, `add_customer_note`, `set_customer_tags` | | Refund policies | `create_refund`, `list_refunds`, `get_refund` | | Drops and delivery | `get_limited_drop`, `update_limited_drop`, `get_limited_drop_availability`, `get_pdf_stamping`, `update_pdf_stamping`, `get_download_limits`, `update_download_limits`, `get_order_downloads`, `reset_order_downloads` | | License keys | `list_license_keys`, `get_license_key`, `disable_license_key`, `enable_license_key`, `reset_license_key_activations` | | Courses | `get_course_settings`, `update_course_settings`, `list_course_quizzes`, `upsert_course_quiz`, `delete_course_quiz`, `get_course_stats`, `verify_certificate` | | Subscriptions | `create_subscription_offer`, `list_subscription_offers`, `get_subscription_offer`, `cancel_subscription`, `pause_subscription`, `resume_subscription` | | Usage billing | `update_usage_pricing`, `get_subscription_usage`, `report_usage`, `update_subscription_seats` | | Subscription retention | `get_recovery_summary`, `list_at_risk_subscriptions`, `get_recovery_settings`, `update_recovery_settings`, `get_save_offers_report`, `get_intro_pricing_report`, `list_retention_offers`, `get_retention_offer`, `update_retention_offer` | | Memberships and communities | `list_memberships`, `create_membership`, `get_membership`, `update_membership`, `list_membership_members`, `ban_member`, `unban_member`, `list_member_posts`, `create_member_post`, `update_member_post`, `delete_member_post`, `list_community_threads`, `get_community_thread`, `moderate_community_thread`, `delete_community_thread`, `moderate_community_reply`, `delete_community_reply` | | Reviews and testimonials | `list_reviews`, `list_testimonials`, `get_testimonial`, `moderate_testimonial`, `get_testimonial_settings`, `update_testimonial_settings` | | Attribution survey | `get_attribution_survey`, `update_attribution_survey`, `get_attribution_report` | | Loyalty and store credit | `get_loyalty_settings`, `update_loyalty_settings`, `get_loyalty_summary`, `list_loyalty_members`, `list_loyalty_activity`, `adjust_loyalty_points` | | Affiliate tiers | `get_affiliate_tiers`, `update_affiliate_tiers`, `list_affiliate_tier_progress`, `get_affiliate_tier_progress`, `list_affiliate_bonuses`, `get_my_affiliate_progress` | | Tracked links | `list_tracked_links`, `create_tracked_link`, `get_tracked_link_stats`, `update_tracked_link` | | Revenue splits | `list_revenue_splits`, `create_revenue_split`, `get_product_revenue_split`, `list_revenue_split_sales`, `list_revenue_split_invites`, `accept_revenue_split_invite`, `decline_revenue_split_invite`, `remove_revenue_split`, `get_revenue_split_earnings` | | Newsletters | `list_posts`, `create_post`, `get_post`, `update_post`, `delete_post`, `send_post`, `send_email`, `list_subscribers`, `get_subscriber`, `delete_subscriber` | | Resends and subject tests | `get_post_resend`, `resend_to_non_openers`, `cancel_resend`, `get_subject_test`, `start_subject_test` | | Paid newsletter | `get_paid_newsletter`, `update_paid_newsletter`, `get_newsletter_stats`, `sync_paid_subscribers`, `set_post_audience` | | Segments | `list_segments`, `create_segment`, `get_segment`, `get_segment_count`, `preview_segment` | | Signup forms | `list_signup_forms`, `create_signup_form`, `get_signup_form`, `update_signup_form`, `delete_signup_form` | | Link in Bio | `get_creator_page`, `create_creator_page`, `update_creator_page` | | Analytics | `get_analytics_preview`, `get_analytics_summary`, `get_sales_funnel`, `get_revenue_by_source`, `get_repeat_buyer_cohorts`, `get_net_revenue`, `get_mrr`, `get_benchmarks` | | Weekly report | `get_weekly_report`, `get_weekly_report_settings`, `update_weekly_report_settings` | | Google Sheets sync | `get_sheets_sync`, `connect_google_sheets`, `set_sheets_spreadsheet`, `update_sheets_sync`, `backfill_sheets_sync`, `sync_sheets_now`, `retry_sheets_sync` | | Webhooks | `list_webhooks`, `create_webhook`, `get_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` | | Migrations | `list_import_platforms`, `list_import_jobs`, `create_import_job`, `get_import_job`, `add_import_file`, `update_import_mapping`, `list_import_rows`, `connect_import_account`, `dry_run_import_job`, `start_import_job`, `cancel_import_job`, `get_import_report` | | Team | `list_team_members`, `list_team_activity`, `invite_team_member`, `resend_team_invite`, `cancel_team_invite`, `update_team_member`, `remove_team_member`, `create_team`, `update_team`, `delete_team` | | Partners | `become_partner`, `get_partner`, `register_referral`, `list_referrals`, `list_referral_sales`, `get_partner_stats` | | Referrals and recommendations | `get_creator_referral_stats`, `list_referred_stores`, `get_referral_badge_stats`, `update_store_badge`, `get_recommendations`, `update_recommendations`, `search_recommendable_creators` | | Agencies | `get_agency`, `create_agency`, `update_agency`, `list_agency_clients`, `remove_agency_client`, `list_agency_statements`, `get_agency_statement`, `get_store_agency`, `invite_agency`, `remove_store_agency` | | Penny decisions | `penny_decide`, `penny_usage` | | Creator services | `get_creator_services`, `get_account_manager`, `request_slack_channel`, `list_dispute_help_requests`, `create_dispute_help_request`, `list_dispute_covers`, `get_dispute_cover` | | Plans | `get_entitlements`, `get_plan`, `list_plans` | | Account | `get_account`, `update_selling_profile`, `update_tracking_pixels` | > [!NOTE] > > **Paid features follow the account's plan.** Upsells, abandoned checkout > recovery, premium templates and ad pixels need a paid plan (see [Plans and > limits](/concepts/plans-and-limits)). Agents are told to call > `get_entitlements` before using one. A tool that would turn on a feature the > plan does not include returns a `403 FEATURE_LOCKED` tool error with the > plan to upgrade to and the billing link, > `https://app.pocketsflow.com/profile/billing`. Nothing is saved, so the > agent tells the creator instead of retrying. Plans cannot be bought through > MCP. `get_plan` is an alias of `get_entitlements`; > `get_abandoned_checkout_summary` works on every plan. > [!NOTE] > > **Agents start from what the creator told us.** `get_account` returns > `sellingPath` (what they sell) and `sellingSetup` (`pages`: they sell on > Pocketsflow creator and product pages; `code`: inside their own site or app, > with the embedded checkout, checkout sessions or the SDK). The server asks > agents to read both first and set up what fits, and to ask the creator, then > save the answer with `update_selling_profile`, when they skipped the > question in onboarding. > [!NOTE] > > **Email tools follow the same sending rules as the API.** `send_email`, > `send_post` and `create_post` / `update_post` with a schedule call the same > endpoints, so they get the same answers: a paused account returns `403 > EMAIL_SENDING_PAUSED`, a new account over its daily limit returns `429 > DAILY_SEND_LIMIT`, and addresses that bounced or reported spam come back in > `skipped`. See [Deliverability > protection](/api-reference/send-email#deliverability-protection). > [!NOTE] > > `update_pricing` is an alias of `update_product` for agents that ask to change > price. Creator payouts remain dashboard/JWT-only and are not exposed as MCP > tools. > [!NOTE] > > The **Payments** tools expose the unified ledger (one-time purchases *and* > subscription renewals), and the **subscriber** tools return live membership > status plus full payment history — the same data as [`GET > /payments`](/api-reference/introduction#payments) and [`GET > /subscriptions/subscribers`](/api-reference/introduction#subscriptions-and-subscribers). > Ask things like *"how much recurring revenue did I collect last month?"* or > *"list my past-due subscribers."* > [!NOTE] > > The tool list is generated from the public API contract, so it stays in sync > as the API evolves. Call `tools/list` on the endpoint (or check your agent's > tool panel) for the authoritative, current set. ## How it works The MCP server is part of the Pocketsflow backend — there is no separate service to run or host. Each tool call is forwarded to the corresponding public REST endpoint with the connection's API key (for an OAuth connection, its `MCP: …` key), so validation, permissions, and per-account data scoping are identical to calling the API directly. The transport is **stateless Streamable HTTP**: the agent POSTs JSON-RPC messages (`initialize`, `tools/list`, `tools/call`) to `/mcp` and receives a JSON response. No session state is stored server-side. You can call it directly without an agent framework. `curl` can't run the browser sign-in, so send an API key on every request: ```bash theme={"system"} curl https://www.pocketsflow.com/mcp \ -H "Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_orders", "arguments": { "pageSize": 20 } } }' ``` Because each tool maps to the underlying REST endpoint, tool arguments mirror the endpoint's parameters (for example `list_orders` accepts pagination filters; `create_subscription_offer` accepts offer fields; `update_pricing` / `update_product` accept the product `id` plus fields to change). Errors surface as MCP tool errors carrying the same status and message the REST endpoint would return (for example a `401` for an invalid key). Use a `pk_test_…` key to exercise everything safely against sandbox data first. ## Related topics * [MCP setup guide](/ai-tools/mcp) — Claude Desktop, Cursor, ChatGPT * [API reference](/api-reference/introduction) — the underlying REST endpoints * [Authentication & security](/api-webhooks/authentication-and-security) * [Webhooks & API overview](/api-webhooks/overview) # Memberships API Source: https://docs.pocketsflow.com/api-reference/memberships Create memberships, publish members-only posts, moderate the community and list members. Memberships (Pro plan and above) give your subscribers members-only posts, a community and included products. All routes take an API key (`Authorization: Bearer `). The full reference is in the [interactive API explorer](https://api.pocketsflow.com/docs) under **Memberships**; the summary is in [Endpoints](/api-reference/endpoints#memberships). ## Plan rules | Action | Needs Pro | | - | - | | List, read, members list | No | | Create a membership, edit it | Yes (`403` `FEATURE_LOCKED`) | | Archive / reopen, switch community or post emails off | No | | Write, edit or publish a post | Yes | | Pin / unpin, move a post back to draft, delete | No | | Start a thread or reply as the creator | Yes | | Hide, lock, pin, delete threads and replies, ban / unban | No | ## Create a membership and publish a post ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/memberships \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "The Studio", "offerIds": ["665f1c2a9b3e4a0012ab34ce"], "productIds": ["665f1c2a9b3e4a0012ab34cd"] }' curl -X POST https://api.pocketsflow.com/memberships/6711a0c4e1b2c3d4e5f60a01/posts \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "October teardown", "html": "

Three pricing pages that doubled conversion.

", "status": "published", "notify": true }' ``` The post's `notifyState` goes `pending` → `sending` → `sent`; `notifiedCount` says how many members were emailed. Each member is emailed at most once per post. ## Moderate ```bash theme={"system"} # Hide a thread (members stop seeing it; you still do) curl -X PATCH https://api.pocketsflow.com/memberships/6711a0c4e1b2c3d4e5f60a01/threads/6711a0c4e1b2c3d4e5f60c01 \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "hidden": true }' # Ban the author from your communities and hide everything they wrote curl -X POST https://api.pocketsflow.com/memberships/members/ban \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "spam@example.com", "hideContent": true }' ``` Threads and replies include the author's `email` here (never on the storefront). `replyCount` counts visible replies only. ## Members `GET /memberships/{id}/members?status=active&q=ana&page=1` lists everyone who subscribed to the membership's offers, one row per email. `status` is `active` while a subscription is live, `ended` after. `counts` gives the totals per filter. ## Webhooks | Event | When | Data | | - | - | - | | `member.joined` | A subscription to one of the offers went live (or the membership was created / its offers changed) | `membership` (`id`, `name`, `slug`), `member` (`email`, `name`), `joinedAt` | | `member.left` | The person no longer has a live subscription, or the membership changed / was archived / deleted | the same, plus `leftAt` and `reason`: `subscription_ended`, `membership_changed` or `membership_closed` | Each transition fires once, even when the payment events arrive more than once. ## MCP The MCP server exposes `list_memberships`, `create_membership`, `get_membership`, `update_membership`, `list_membership_members`, `ban_member`, `unban_member`, `list_member_posts`, `create_member_post`, `update_member_post`, `delete_member_post`, `list_community_threads`, `get_community_thread`, `moderate_community_thread`, `delete_community_thread`, `moderate_community_reply` and `delete_community_reply`. # Migrations Source: https://docs.pocketsflow.com/api-reference/migrations Import products, customers, purchase history and email subscribers from Gumroad, Lemon Squeezy, Stan Store or any CSV. Volume plan and above. An **import** (a migration job) moves a store from another platform into yours: upload the platform's CSV exports or pull with its API token, check every row, dry-run, then start a background run that is idempotent and resumable. Purchase history is saved as **imported records**, never as sales: it never counts toward revenue, fees, payouts or webhooks. Subscribers are never emailed by the import. > [!NOTE] > > Creating and running an import needs the **Volume** plan. Below it, every > write answers `403` with `code: FEATURE_LOCKED` and > `details.requiredPlan: "volume"` — API keys and MCP included. Reading an > import, its report and its row CSV, and cancelling, always work. ## Endpoints | Method | Path | What it does | | - | - | - | | `GET` | `/migrations/platforms` | Sources, the CSV columns each export uses, API support | | `GET` | `/migrations` | Your imports, newest first (`page`, `pageSize` ≤ 100) | | `POST` | `/migrations` | Create a draft import (optionally with `files`) | | `GET` | `/migrations/{id}` | The import: files, mapping, dry run, status, progress | | `POST` | `/migrations/{id}/files` | Add (or replace) one CSV export | | `PUT` | `/migrations/{id}/files/{kind}/mapping` | Fix the column mapping; rows are validated again | | `DELETE` | `/migrations/{id}/files/{kind}` | Remove a file | | `GET` | `/migrations/{id}/rows` | Rows of one kind with errors (`kind`, `filter`, `page`) | | `POST` | `/migrations/{id}/connect` | Pull from Gumroad / Lemon Squeezy with a token | | `POST` | `/migrations/{id}/dry-run` | What the run will create, skip and leave out | | `POST` | `/migrations/{id}/start` | Queue the background run (`202`) | | `POST` | `/migrations/{id}/cancel` | Stop after the current batch | | `GET` | `/migrations/{id}/report` | Per-kind results, products that need a file | | `GET` | `/migrations/{id}/errors.csv` | Every row not imported cleanly, as CSV | `source` is `gumroad`, `lemonsqueezy`, `stan` or `csv`. `kind` is `products`, `customers`, `orders` (purchase history) or `subscribers`. ## Example: a Gumroad move ```bash theme={"system"} # 1. Create the import with the sales and followers exports curl -X POST https://api.pocketsflow.com/migrations \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n --rawfile sales sales.csv --rawfile followers followers.csv \ '{source:"gumroad", files:[{kind:"orders", filename:"sales.csv", csv:$sales}, {kind:"subscribers", filename:"followers.csv", csv:$followers}]}')" # 2. Products: Gumroad has no product CSV, so pull them with a token (never stored) curl -X POST https://api.pocketsflow.com/migrations/$ID/connect \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" -d '{"token":""}' # 3. Check the rows with errors, then dry-run curl "https://api.pocketsflow.com/migrations/$ID/rows?kind=orders&filter=problems" \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" curl -X POST https://api.pocketsflow.com/migrations/$ID/dry-run \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" # 4. Start, then poll until status is "completed" curl -X POST https://api.pocketsflow.com/migrations/$ID/start \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" curl https://api.pocketsflow.com/migrations/$ID -H "Authorization: Bearer $POCKETSFLOW_API_KEY" ``` ## Dry run ```json theme={"system"} { "computedAt": "2026-10-17T09:12:00.000Z", "canStart": true, "subscriberLimit": null, "kinds": { "products": { "total": 24, "invalid": 0, "skipped": 0, "create": 22, "existing": 2, "filesToDownload": 17, "fileNeeded": 5 }, "orders": { "total": 4290, "invalid": 4, "skipped": 0, "create": 4286, "alreadyImported": 0, "newCustomers": 1840, "refunded": 61 }, "subscribers": { "total": 6512, "invalid": 12, "noConsent": 80, "create": 6420, "active": 6105, "unsubscribed": 315, "existing": 0, "suppressed": 0, "overLimit": 0, "activeNow": 214 } }, "notes": ["Purchase history is saved as imported records. It never counts as sales, revenue, fees or payouts."] } ``` ## How the run behaves * **Order:** products, then customers, then purchase history (matched to the products by source id or name), then subscribers. * **Idempotent:** products match on the platform's product id or the name, customers and subscribers on the email, purchases on the platform's order id (or a stable hash of the row). Nothing is created twice. * **Resumable:** the run holds a lease and renews it per batch; if it stops, the sweep resumes it within a minute from the first row not yet done. `start` on a `failed` or `canceled` import imports the rest. * **Existing data wins:** a product, customer or subscriber you already have is skipped, never overwritten. A subscriber's status is never changed. * **Consent:** each imported subscriber carries `consent` (`source` such as `gumroad_csv` or `lemonsqueezy_api`, the platform's wording, the opt-in date). Statuses without consent (`archived`, `requires_verification`, unknown) are left out; `unsubscribed` / `bounced` are imported with that status. Addresses on the bounce / spam complaint list are left out. * **Files:** product files download from public `https://` links only (no private addresses, re-checked on every redirect), up to your plan's upload size, for deliverable file types only. Otherwise the product is marked `fileNeeded` with the reason in the report. ## White-glove imports Our team can run the import for a Volume creator from the admin dashboard. Those imports show up in `GET /migrations` with `createdBy.type: "admin"` and work exactly like yours. ## MCP `list_import_platforms`, `list_import_jobs`, `create_import_job`, `get_import_job`, `add_import_file`, `update_import_mapping`, `list_import_rows`, `connect_import_account`, `dry_run_import_job`, `start_import_job`, `cancel_import_job`, `get_import_report`. # Paid newsletter API Source: https://docs.pocketsflow.com/api-reference/paid-newsletter Turn on a paid newsletter, set who reads each post, and read paid subscribers, MRR and conversion. The paid newsletter (Growth plan and above) is fully available to API keys and MCP agents. Reads work on every plan. Writes that turn it on answer `403` with `code: FEATURE_LOCKED` when the plan does not include it: ```json theme={"system"} { "error": "FEATURE_LOCKED", "code": "FEATURE_LOCKED", "upgradeRequired": true, "message": "This feature is part of a higher plan. Please upgrade your plan to use it.", "details": { "feature": "paidNewsletter", "requiredPlan": "tier2", "requiredPlanName": "Growth" } } ``` ## Endpoints | Method | Path | MCP tool | What it does | | - | - | - | - | | `GET` | `/newsletters/paid` | `get_paid_newsletter` | Settings, membership offers, archive link and numbers | | `PUT` | `/newsletters/paid` | `update_paid_newsletter` | Turn it on/off, pick the monthly / yearly offers, name it | | `GET` | `/newsletters/paid/stats` | `get_newsletter_stats` | Paid subscribers, MRR, free → paid conversion | | `POST` | `/newsletters/paid/sync` | `sync_paid_subscribers` | Re-sync the `paid` subscriber tag | | `POST` | `/newsletters/posts/{id}/audience` | `set_post_audience` | Set a post's audience, preview and archive options | `POST /newsletters/posts` and `POST /newsletters/posts/{id}` accept the same `audience`, `sendPreviewToFree` and `publishToWeb` fields. ## Turn it on ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/newsletters/paid \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "monthlyOfferId": "665f1c2a9b3e4a0012ab34cd", "yearlyOfferId": "665f1c2a9b3e4a0012ab34ce", "title": "The Studio Letter" }' ``` Both offers must be your own subscription offers, billed monthly and yearly respectively, and in the same test / live mode. ## Send a paid post ```bash theme={"system"} # 1. Create the post — the paywall marker ends the free preview curl -X POST https://api.pocketsflow.com/newsletters/posts \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Issue 12", "subject": "Issue 12: pricing, part two", "preview": "What we changed and why", "contentHtml": "

Free intro…

{{paywall}}

The paid part…

", "sendToAll": true, "audience": "paid", "publishToWeb": true }' # 2. Send it curl -X POST https://api.pocketsflow.com/newsletters/posts//send \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` Paid subscribers get the whole post. Free subscribers get everything above `{{paywall}}` (or an element with `data-pf-paywall`) plus a subscribe button that opens checkout for your membership. Set `sendPreviewToFree: false` to send to paid subscribers only. A paid post without a marker sends free subscribers only its subject, preview line and the button. | `audience` | Recipients | | - | - | | `everyone` (default) | Everyone the post targets, whole post | | `free` | Only targeted subscribers without a paid membership | | `paid` | Paid members: whole post. Free subscribers: preview + CTA | Sending a `free` / `paid` post answers `400` with `code: PAID_NEWSLETTER_DISABLED` while the paid newsletter is off. ## Stats ```bash theme={"system"} curl https://api.pocketsflow.com/newsletters/paid/stats \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` ```json theme={"system"} { "paidSubscribers": 31, "freeSubscribers": 1204, "mrrCents": 25500, "currency": "USD", "conversionRate": 0.0251, "monthlyMembers": 24, "yearlyMembers": 7, "newPaidLast30Days": 9, "canceledLast30Days": 2 } ``` `mrrCents` counts active and trialing memberships; yearly plans count one twelfth. `paidSubscribers` also counts members in a payment retry window or paused. ## Webhooks Paid memberships are subscriptions to your membership offers, so the existing `customer.subscription.*` and `invoice.*` events cover them — filter on the offer id (`subscriptionId`). # Penny decision API Source: https://docs.pocketsflow.com/api-reference/penny Ask Pocketsflow Penny 1 one typed question about a situation and get the answer with a calibrated confidence. 1,000 free decisions a month. **Pocketsflow Penny 1** is a small open decision model (0.6B parameters). You give it a situation (the *state*) and one typed question; it answers with a calibrated **confidence** and tells you whether that confidence is high enough to act without a person (`auto`). Penny never writes text. Its answer is a single token, read from the model's next-token probabilities, so every call is one fast forward pass and the probabilities themselves are the confidence. Read how it was trained and measured on the [Penny research page](https://www.pocketsflow.com/research/penny). Base URL `https://api.pocketsflow.com`, API key in the `Authorization` header, like every other endpoint. Available on every plan. ## Ask a question ```bash theme={"system"} curl https://api.pocketsflow.com/v1/penny/decide \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "state": { "order_id": "ord_123", "amount": 49.99, "reason": "Never received the file", "days_since_purchase": 3 }, "question": "What should we do with this refund request?", "type": "choice", "options": ["Refund in full", "Offer store credit", "Decline politely"] }' ``` ```json theme={"system"} { "model": "pocketsflow-penny-1", "type": "choice", "choice": "Refund in full", "index": 0, "confidence": 0.9112, "probs": [0.9112, 0.0701, 0.0187], "auto": true, "usage": { "free_remaining": 958, "credits_remaining": 0 } } ``` | Field | Required | Notes | | - | - | - | | `state` | yes | The situation: prose, an email, a table row, or any JSON object. An object is sent to the model as 2-space JSON. At most 8,000 characters (after that conversion). | | `question` | yes | One question about the state, at most 500 characters. | | `type` | yes | `choice`, `yes_no` or `score` (below). | | `options` | `choice` only | 2 to 8 options, one line and at most 120 characters each. Leave it out for `yes_no` and `score`. | ## The three question types | Type | Penny answers | Answer fields | `probs` | | - | - | - | - | | `choice` | One of your 2 to 8 `options` | `choice` (the option, exactly as you sent it) and `index` (0-based) | One per option, in your order | | `yes_no` | Yes or no | `yes` (`true` or `false`) | `[yes, no]` | | `score` | A number from 1 (lowest) to 5 (highest) | `score`: the expected score, two decimals (for example `3.93`) | Scores 1 to 5 | For `score`, say in the question what 1 and 5 mean: `"How likely is this payment to be fraud? 1 = very unlikely, 5 = very likely"`. ```json theme={"system"} { "model": "pocketsflow-penny-1", "type": "yes_no", "yes": false, "confidence": 0.88, "probs": [0.12, 0.88], "auto": true, "usage": { "free_remaining": 957, "credits_remaining": 0 } } ``` ## Confidence and `auto` `confidence` is Penny's calibrated probability that its answer is right: across many answers given at `0.9`, about 9 in 10 are correct. * `choice` and `yes_no`: the probability of the chosen answer. * `score`: the probability that the true score is within one point of the rounded `score`. `auto` is `true` when `confidence` reaches the threshold for the question type, the point where Penny's answers were right often enough to act on without a person: | Type | `auto` from | | - | - | | `choice` | 0.79 | | `yes_no` | 0.72 | | `score` | 0.8 | The pattern: act on `auto: true` answers, and send the rest to a person with Penny's answer as a suggestion. ```ts Node.js SDK theme={"system"} import { Pocketsflow } from "pocketsflow"; const pocketsflow = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY!, }); const decision = await pocketsflow.penny.decide({ state: payout, question: "Should we release this payout now?", type: "yes_no", }); if (decision.auto) { decision.yes ? await releasePayout(payout) : await holdPayout(payout); } else { await askATeammate(payout, decision); } ``` ```js fetch theme={"system"} const res = await fetch("https://api.pocketsflow.com/v1/penny/decide", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ state: payout, question: "Should we release this payout now?", type: "yes_no", }), }); const decision = await res.json(); if (decision.auto) { decision.yes ? await releasePayout(payout) : await holdPayout(payout); } else { await askATeammate(payout, decision); } ``` ## Pricing: free tier, then credits * **1,000 free decisions** per account every calendar month (UTC). The count resets on the 1st. * After that, each decision uses one prepaid **credit**: **\$10 buys 100,000 decisions**. The free tier is always used first. * Only answered decisions count. A request that fails validation or that the model could not answer (`502`) is never counted. When the month's free decisions are used and no credits are left, the API answers `402`, with a checkout link for more credits in `buy_url`: ```json theme={"system"} { "error": "penny_credits_exhausted", "message": "You have used your 1,000 free Penny decisions this month and have no credits left. Buy credits at buy_url to keep going.", "buy_url": "https://buy.polar.sh/polar_c_..." } ``` ## Check your usage ```bash theme={"system"} curl https://api.pocketsflow.com/v1/penny/usage \ -H "Authorization: Bearer pk_live_..." ``` ```json theme={"system"} { "free_limit": 1000, "free_used": 42, "free_remaining": 958, "credits_remaining": 0, "buy_url": "https://buy.polar.sh/polar_c_..." } ``` `credits_remaining` is `null` when the balance could not be read right now; `buy_url` is `null` when credits are not on sale. ## Node.js SDK The official [`pocketsflow`](https://www.npmjs.com/package/pocketsflow) package (3.6.0 and later) wraps both endpoints and types the answer: ```ts theme={"system"} import { Pocketsflow, PocketsflowError } from "pocketsflow"; const pocketsflow = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY!, }); try { const decision = await pocketsflow.penny.decide({ state: { order_id: "ord_123", amount: 49.99, reason: "Never received the file", }, question: "What should we do with this refund request?", type: "choice", options: ["Refund in full", "Offer store credit", "Decline politely"], }); decision.choice; // "Refund in full" decision.auto; // true: confident enough to act without a person } catch (error) { if (error instanceof PocketsflowError && error.status === 402) { console.log("Out of decisions. Buy more:", error.body?.buy_url); } } const usage = await pocketsflow.penny.usage(); usage.free_remaining; // 958 ``` TypeScript requires `options` for `type: "choice"` and rejects it for `yes_no` and `score`. See the [SDK reference](/api-reference/sdk-reference#penny). ## Errors | Status | `error` | Meaning | | - | - | - | | `400` | `invalid_request` | The body failed validation; `message` says which field. | | `401` | | Missing or invalid API key. | | `402` | `penny_credits_exhausted` | Free decisions used and no credits left. Buy more at `buy_url`. | | `429` | | Rate limited (600 requests per minute per account). | | `502` | `penny_inference_failed` | The model did not answer. Nothing was counted; retry. | | `503` | `penny_unavailable` | Penny is switched off. Retry later. | | `503` | `penny_billing_unavailable` | Free decisions used and your credit balance could not be read. Retry in a moment. | ## Try it without a key The [Penny playground](https://www.pocketsflow.com/research/penny/playground) asks the same model from your browser, no account needed. # Unique coupons and personal deadlines Source: https://docs.pocketsflow.com/api-reference/promotions Issue one-time codes per recipient and give every subscriber their own offer window, from the API, the SDK or an AI agent. Both features are plan-gated: unique coupons need **Growth**, personal deadlines need **Pro**. A gated write answers `403` with `code: FEATURE_LOCKED` and `details.requiredPlan`. Reads, deletes and CSV exports are never gated. ## Unique coupons Turn a discount into a unique-per-recipient discount: ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/discounts \ -H "Authorization: Bearer pk_live_…" \ -H "Content-Type: application/json" \ -d '{ "name": "VIP 20%", "code": "VIP", "value": 20, "mainProductIds": ["665f1c2a9b3e4a0012ab34cd"], "uniquePerRecipient": true, "uniqueExpiryHours": 48 }' ``` `code` becomes the prefix of each one-time code and no longer works by itself. | Method | Path | What it does | | - | - | - | | `GET` | `/discounts/{id}/unique-codes` | Issued / redeemed / expired counts and a page of codes (`status`, `limit`, `before`) | | `POST` | `/discounts/{id}/unique-codes` | Issue codes: `{ "emails": [...] }` (bound) or `{ "count": 500 }` (unbound), optional `expiresInHours` | | `GET` | `/discounts/{id}/unique-codes/export` | Every code as CSV: `code,email,status,expires_at,redeemed_at` | In emails, `{{unique_coupon:}}` issues one code per recipient at send time and `{{unique_coupon_url:}}` links to checkout with it. ### At checkout `GET /discounts/apply/{code}/{productId}?email=` (public) resolves a one-time code only for its email: | Status | `code` | When | | - | - | - | | `200` | — | The discount, plus `uniqueCode: { code, expiresAt, emailBound }` | | `422` | `UNIQUE_CODE_EMAIL_REQUIRED` | The code is bound to an email and none was sent | | `403` | `UNIQUE_CODE_EMAIL_MISMATCH` | Another email | | `409` | `UNIQUE_CODE_IN_USE` | Another open checkout holds the code (up to 30 minutes) | | `410` | `UNIQUE_CODE_REDEEMED` / `UNIQUE_CODE_EXPIRED` / `UNIQUE_CODE_UNAVAILABLE` | Used, expired, or the seller's plan no longer includes it | Creating a checkout reserves the code (and a personal offer) for that checkout for 30 minutes, so two checkouts opened at once can't both be paid at the discounted price. The payment consumes it; a declined or abandoned checkout gives it back. ## Personal deadlines ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/personal-deadlines \ -H "Authorization: Bearer pk_live_…" \ -H "Content-Type: application/json" \ -d '{ "name": "72-hour launch offer", "productId": "665f1c2a9b3e4a0012ab34cd", "durationHours": 72, "offer": { "type": "percentage", "value": 30 }, "fallback": { "type": "full_price" }, "trigger": { "type": "audience_joined" } }' ``` | Method | Path | What it does | | - | - | - | | `GET` | `/personal-deadlines` | Your deadlines with `stats` | | `POST` | `/personal-deadlines` | Create one | | `GET` / `POST` / `DELETE` | `/personal-deadlines/{id}` | Read, partially update, delete | | `GET` | `/personal-deadlines/{id}/entries` | The people on it and their state | | `POST` | `/personal-deadlines/{id}/start` | Start `email`'s clock now and get their personal link (idempotent) | | `GET` | `/personal-deadlines/{id}/link?email=` | Their personal link, without starting the clock | | `GET` | `/personal-deadlines/public/offer?productId=&sid=` | Public: a visitor's own window on a product | `offer.type` is `percentage`, `fixed` or `price`; `fallback.type` is `full_price`, `percentage` or `fixed`; `trigger.type` is `audience_joined`, `lead_magnet` (with `productId`) or `automation_entered` (with `automationId`). The personal link (`?pf_sid=…`) identifies the person on your store. It is the same encrypted visitor token that browse abandonment uses, so one link serves both. Without the server's signing key, links are plain product links (`personalized: false`) and personal offers don't apply. The offer itself is enforced from their server-side clock: after it ends, or once they bought at the offer price, checkout charges the fallback price whatever token they bring. ## SDK and MCP The MCP server exposes `list_unique_codes`, `generate_unique_codes`, `list_personal_deadlines`, `create_personal_deadline`, `get_personal_deadline`, `update_personal_deadline`, `delete_personal_deadline`, `list_personal_deadline_entries`, `start_personal_deadline` and `get_personal_deadline_link`. The Node.js SDK gains the same operations in its next release. # Resends and subject tests Source: https://docs.pocketsflow.com/api-reference/resend-and-subject-tests Resend a post to the people who did not open it, and send a post with an A/B subject test, from the API or an AI agent. Both work on newsletter posts (`/newsletters/posts`). Product guide: [Resends and subject tests](/selling/resend-and-subject-tests). > [!NOTE] > > Growth plan and above. Scheduling a resend and starting a subject test > answer `403` with `code: FEATURE_LOCKED` below it. Reading and cancelling > stay open. Every email counts toward your monthly sends and goes through > the same checks as `POST /newsletters/posts/{id}/send` (`402 > SEND_ALLOWANCE_EXCEEDED`, `429 DAILY_SEND_LIMIT`, …). ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/newsletters/posts/{id}/resend` | `getPostResend` | `get_post_resend` | | `POST` | `/newsletters/posts/{id}/resend` | `scheduleResendToNonOpeners` | `resend_to_non_openers` | | `DELETE` | `/newsletters/posts/{id}/resend` | `cancelResendToNonOpeners` | `cancel_resend` | | `GET` | `/newsletters/posts/{id}/subject-test` | `getSubjectTest` | `get_subject_test` | | `POST` | `/newsletters/posts/{id}/subject-test` | `startSubjectTest` | `start_subject_test` | ## Resend to non-openers ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/newsletters/posts/POST_ID/resend \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "subject": "In case you missed it: the spring drop", "delayHours": 48 }' ``` The resend is scheduled `delayHours` (1–168, default 48) after the original send, and never sooner than 10 minutes from now. When it runs it goes to everyone who received the post (or one of its subject-test arms), has not opened it and is still subscribed. It is its own post (`resend.postId`). `GET` answers `recipients`, `opened`, `openRate`, `nonOpeners` (who it would go to right now), `eligible` with a `reason` when not (`NOT_SENT`, `ALREADY_SCHEDULED`, `ALREADY_RESENT`, `NO_NON_OPENERS`, …) and `resend` with its status and its own `sent` / `opened` / `openRate`. ## Subject tests ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/newsletters/posts/POST_ID/subject-test \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "subjectB": "20% off the spring drop", "testPercent": 20, "waitHours": 4 }' ``` Call it on a draft instead of `/send`. Subject A (the post's subject) and B go to two random halves of a `testPercent` slice (10–50, default 20) right away; after `waitHours` (1–72, default 4) the subject with the higher unique open rate wins (a tie keeps A), and the post is sent with it to everyone else. The post stays `scheduled` until then. The audience needs at least 50 subscribers (`400 AUDIENCE_TOO_SMALL`). `GET` answers `subjectTest` (settings, `status: testing | decided`, `winner`, `results`), `arms.A` / `arms.B` with live unique opens, and `rest`, the winner's send. ## Opens Opens are unique per person: every campaign email carries a signed 1×1 tracking image and the first load counts. Image blocking and privacy proxies make any open count approximate. ## SDK ```ts theme={"system"} await pocketsflow.posts.resendToNonOpeners(postId, { subject: "Did you see this?" }); await pocketsflow.posts.startSubjectTest(postId, { subjectB: "Another subject" }); const test = await pocketsflow.posts.getSubjectTest(postId); ``` # Revenue splits Source: https://docs.pocketsflow.com/api-reference/revenue-splits Invite co-creators, accept splits and read split earnings with your API key or from an AI agent over MCP. A revenue split shares every sale of one product between its owner and up to five co-creators. The owner invites a co-creator by email with a % share; the co-creator accepts; every sale after that is split. Product guide: [Revenue splits](/selling/revenue-splits). > [!NOTE] > > Inviting needs the Growth plan and above: `POST /revenue-splits` and > `POST /revenue-splits/{id}/resend` answer `403` with `code: FEATURE_LOCKED` > on a plan without revenue splits. Listing, reading, removing and > everything a co-creator does (invites, accept, decline, earnings) stay > open on every plan. ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/revenue-splits` | `listRevenueSplits` | `list_revenue_splits` | | `POST` | `/revenue-splits` | `createRevenueSplit` | `create_revenue_split` | | `GET` | `/revenue-splits/{id}` | `getRevenueSplit` | — | | `DELETE` | `/revenue-splits/{id}` | `removeRevenueSplit` | `remove_revenue_split` | | `POST` | `/revenue-splits/{id}/resend` | `resendRevenueSplitInvite` | — | | `GET` | `/revenue-splits/products/{id}` | `getProductRevenueSplit` | `get_product_revenue_split` | | `GET` | `/revenue-splits/sales` | `listRevenueSplitSales` | `list_revenue_split_sales` | | `GET` | `/revenue-splits/sales/{id}` | `getRevenueSplitSale` | — | | `GET` | `/revenue-splits/invites` | `listRevenueSplitInvites` | `list_revenue_split_invites` | | `POST` | `/revenue-splits/invites/{id}/accept` | `acceptRevenueSplitInvite` | `accept_revenue_split_invite` | | `POST` | `/revenue-splits/invites/{id}/decline` | `declineRevenueSplitInvite` | `decline_revenue_split_invite` | | `GET` | `/revenue-splits/earnings` | `getRevenueSplitEarnings` | `get_revenue_split_earnings` | Money is always **integer cents** of the seller's settlement currency (`currency`), in fields ending in `Cents`. Shares are `sharePercent` (up to two decimals) and `shareBps` (basis points, `3000` = 30%). ## Invite a co-creator ```bash theme={"system"} curl https://api.pocketsflow.com/revenue-splits \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "productId": "665f1c2a9b3e4a0012ab34cd", "email": "maya@studio.co", "sharePercent": 30 }' ``` | Field | Required | Notes | | - | - | - | | `productId` | yes | One of your products. | | `email` | yes | The co-creator's Pocketsflow account email. | | `sharePercent` | yes | Above 0, up to 100, at most two decimals. | The answer is the split with `status: "invited"`. Rule breaks answer `409`: `ALREADY_INVITED`, `TOO_MANY_COLLABORATORS` (5 at most) or `SHARES_OVER_100`. ## Accept an invite (co-creator) ```bash theme={"system"} # Invites sent to the key owner's email curl https://api.pocketsflow.com/revenue-splits/invites \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" curl -X POST https://api.pocketsflow.com/revenue-splits/invites/6710c3d59e3f1a0012cd7c01/accept \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" ``` The account must be the invited email and have payouts set up (`409 PAYOUTS_REQUIRED` otherwise). An expired or answered invite is `410`. Sales made after the accept are split; earlier sales are not. ## How a sale is split ```text theme={"system"} base = pre-tax sale − platform fee (once, on the full sale) − affiliate commission co-creator = floor(base × share) (cents) owner = base − every co-creator's share (all rounding goes to the owner) ``` `GET /revenue-splits/sales` (owner) and `GET /revenue-splits/sales/{id}` return this breakdown per order. A co-creator calling `GET /revenue-splits/sales/{id}` only sees their own share and `ownerCents` is `null`. ## Share statuses | Status | Meaning | | - | - | | `pending` | Recorded, not paid yet. | | `held` | An account (co-creator or owner) is under review. Not paid until cleared. | | `paid` | Transferred to the co-creator's payouts account. | | `reversed` | The sale was refunded or disputed before the share was paid. | A share refunded **after** it was paid keeps `status: "paid"` with `clawbackCents` set: it is netted from the co-creator's next payout from the same owner. `GET /revenue-splits/earnings` returns `payoutsEnabled`. When it is `false`, shares are recorded as `pending` and not paid out yet. ## Webhooks | Event | Sent to | When | | - | - | - | | `split.created` | The owner and each co-creator | A sale of a split product is recorded. `split` carries the breakdown; a co-creator's copy only their share. | | `split.paid` | The co-creator and the owner | A co-creator's shares were transferred. `payout` carries `amountCents` (net), `grossCents` and `clawbackCents`. | See [Webhook events](/api-webhooks/events) for the envelope and signatures. # Sales funnels Source: https://docs.pocketsflow.com/api-reference/sales-funnels Create, activate and measure sales funnels with your API key or from an AI agent over MCP. A funnel ties a free **lead magnet** product to an email **sequence** (a real automation with real email posts) and a paid **offer**. The API creates it from a template, turns it on and reports its numbers. Product guide: [Sales funnels](/selling/sales-funnels). > [!NOTE] > > Growth plan and above. `POST /funnels` and `POST /funnels/{id}/activate` > answer `403` with `code: FEATURE_LOCKED` (and `details.requiredPlan`) on a > plan without funnels. Listing, reading, pausing and deleting stay open. ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/funnels/templates` | `listFunnelTemplates` | `list_funnel_templates` | | `GET` | `/funnels` | `listFunnels` | `list_funnels` | | `POST` | `/funnels` | `createFunnel` | `create_funnel` | | `GET` | `/funnels/{id}` | `getFunnel` | `get_funnel` | | `PUT` | `/funnels/{id}` | `renameFunnel` | — | | `DELETE` | `/funnels/{id}` | `deleteFunnel` | — | | `POST` | `/funnels/{id}/activate` | `activateFunnel` | `activate_funnel` | | `POST` | `/funnels/{id}/pause` | `pauseFunnel` | `pause_funnel` | | `GET` | `/funnels/{id}/stats` | `getFunnelStats` | `get_funnel_stats` | Funnels live in the key's mode: a `pk_test_` key sees test-mode funnels and products only. ## Create a funnel ```bash theme={"system"} curl https://api.pocketsflow.com/funnels \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "templateId": "welcome", "leadMagnetProductId": "665f1c2a9b3e4a0012ab34cd", "offerProductId": "665f1c2a9b3e4a0012ab34ce", "offerUrl": "https://acme.pocketsflow.com/notion-os", "discount": { "code": "FUNNEL20", "valueType": "percentage", "value": 20 } }' ``` | Field | Required | Notes | | - | - | - | | `templateId` | yes | `welcome` (5 emails over 7 days), `minicourse` (4 lessons, one a day) or `launch` (3 emails over 72 hours). | | `leadMagnetProductId` | yes | One of your free products ($0, or pay what you want from $0). | | `offerProductId` | yes | One of your paid products. | | `offerUrl` | yes | The http(s) link the offer emails use. The discount code is appended as `?discount=`. | | `discount` | no | `{ code, valueType, value, expiresAt }`. Creates a new code for the offer product (3–32 letters, numbers, `-`, `_`). | | `name` | no | Defaults to ` → `. | The answer is the funnel with `status: "draft"`, its `automationId` and its `emailPostIds`. Edit the emails with the [posts endpoints](/api-reference/endpoints#posts) before you activate it if you like. Errors: `400` with `code` `LEAD_MAGNET_NOT_FREE`, `OFFER_NOT_PAID` or `DISCOUNT_CODE_TAKEN`; `403` `FEATURE_LOCKED`. ## Activate ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/funnels/6710c3d59e3f1a0012cd7a01/activate \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" ``` Activation turns the funnel's automation on under the same rules as any automation, plus two funnel checks: | Status | `code` / `error` | Meaning | | - | - | - | | `403` | `PAID_PLAN_REQUIRED` | Automations need a paid plan. | | `403` | `FEATURE_LOCKED` | Your plan does not include funnels. | | `400` | `SENDER_NOT_VERIFIED` | Verify your sender email in Email settings first. | | `400` | `EMAILS_MISSING` | An email node points at no email post. | | `409` | `SEQUENCE_MISSING` | The funnel's automation was deleted. | ## Stats `GET /funnels/{id}/stats` returns: * `totals`: `leads`, `emailsSent`, `opens`, `clicks`, `purchases`, `buyers`, `revenue`, `conversionRate` (percent), `currency` (your account currency). * `stages`: unique people who got the lead magnet, opened, clicked and bought. * `emails`: per email, in send order, `sent`, `opened` and `clicked`. A purchase counts for the funnel when the buyer's email got the lead magnet first and bought the offer within **30 days** (`attributionWindowDays`). Refunded sales never count. ## Webhook: `funnel.lead` Fired once per new lead (a repeat claim never fires it again). Subscribe to it with `POST /webhooks`. ```json theme={"system"} { "id": "evt_6a43ce05fae6c4f0cb5a2193", "type": "funnel.lead", "created": 1767225600, "webhookId": "6710c3d59e3f1a0012cd7c01", "funnel": { "id": "6710c3d59e3f1a0012cd7a01", "name": "Free Notion Starter → Notion Business OS", "leadMagnetProductId": "665f1c2a9b3e4a0012ab34cd", "offerProductId": "665f1c2a9b3e4a0012ab34ce" }, "lead": { "email": "ana@example.com", "firstName": "Ana", "lastName": "Reader", "subscriberId": "6710c3d59e3f1a0012cd7b11", "subscribed": true, "tag": "lead-free-notion-starter" }, "order": { "id": "6710c3d59e3f1a0012cd7b12" }, "capturedAt": "2026-10-16T09:41:07.000Z" } ``` `subscribed: false` means the person had unsubscribed before: they count as a lead but get no emails. # Pocketsflow Node.js SDK Source: https://docs.pocketsflow.com/api-reference/sdk Install and use the official Pocketsflow SDK for Node.js and TypeScript. The official [`pocketsflow`](https://www.npmjs.com/package/pocketsflow) package is a server-side Node.js and TypeScript client for the Pocketsflow API. It uses the same API-key authentication and endpoint shapes documented in the [API reference](/api-reference/introduction). > [card] [Install from npm](https://www.npmjs.com/package/pocketsflow) > > Add the SDK to a Node.js or TypeScript project. > [card] [View the source](https://github.com/Pocketsflow/pocketsflow-sdk) > > Browse the SDK source, types, examples, and release history. ## Installation ```bash npm theme={"system"} npm install pocketsflow ``` ```bash Yarn theme={"system"} yarn add pocketsflow ``` ```bash pnpm theme={"system"} pnpm add pocketsflow ``` ## Initialize the client Create an API key in **Developers → API keys** and keep it on your server. Use `pk_live_...` for live data or `pk_test_...` for sandbox data. ```ts theme={"system"} import { Pocketsflow } from "pocketsflow"; const pocketsflow = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY!, // Optional. Defaults to https://api.pocketsflow.com. baseUrl: "https://api.pocketsflow.com", // Optional. Defaults to 30 seconds. timeout: 30_000, }); ``` > [!WARNING] > > Never expose an API key in browser code, a mobile app, a public repository, or > a URL. Call the SDK from a trusted server or server-side function. ## Read data Resources expose typed `list()` and `get()` methods: ```ts theme={"system"} const me = await pocketsflow.users.me(); const products = await pocketsflow.products.list(); const product = await pocketsflow.products.get("product_id"); const customers = await pocketsflow.customers.list(); const { orders, pagination } = await pocketsflow.orders.list({ page: 1, pageSize: 20, }); ``` The main namespaces are `products`, `variants`, `orders`, `customers`, `reviews`, `discounts`, `upsells`, `subscriptions`, `subscriptionOffers`, `webhooks`, `users`, `checkout`, `refunds`, and `plans`. ## Create products and webhooks ```ts theme={"system"} const product = await pocketsflow.products.create({ name: "Premium Course", description: "Everything a buyer needs to get started.", price: 49.99, }); await pocketsflow.products.update(product._id, { price: 59.99, }); // Copy a catalog item — a one-time product or a subscription offer (whichever // owns the id). `{ testMode: false }` copies a test-mode offer into live mode; // the copy starts unpublished there. const copy = await pocketsflow.products.copy(product._id, { testMode: false }); const webhook = await pocketsflow.webhooks.create({ url: "https://example.com/webhooks/pocketsflow", events: ["order.completed", "order.refunded"], description: "Pocketsflow events", }); ``` ## Create subscription offers Use `subscriptionOffers` for the recurring products you sell. Use `subscriptions` for the buyers who hold those offers; they are different resources. ```ts theme={"system"} const offer = await pocketsflow.subscriptionOffers.create({ name: "Pro Membership", description: "Access to all premium content.", price: 29, frequency: "monthly", trialPeriod: 7, redirectBackUrl: "https://example.com/account/billing", }); const offers = await pocketsflow.subscriptionOffers.list(); const sameOffer = await pocketsflow.subscriptionOffers.get(offer._id); ``` `frequency` must be `weekly`, `monthly`, or `yearly`. The required fields are `name`, `price`, and `frequency`; the SDK also supports the optional offer fields defined in its TypeScript types. > [!NOTE] > > `subscriptionOffers.create` is available in SDK v1.2.0 and later. If your > installed version predates that release, upgrade or call > `POST /subscriptions` directly until then. ## Create checkout sessions Pass either a one-time product id or a subscription-offer id as `productId`: ```ts theme={"system"} const session = await pocketsflow.checkout.create({ productId: offer._id, successUrl: "https://example.com/welcome", cancelUrl: "https://example.com/pricing", customerEmail: "buyer@example.com", metadata: { plan: "pro" }, }); // Redirect the buyer to session.url. console.log(session.url); ``` ## Manage subscribers The `subscriptions` namespace manages buyer subscriptions and supports listing, retrieval, cancellation, and refunds. The subscriber-specific lifecycle methods are also available through the API endpoints documented in the [subscriptions quickstart](/api-reference/subscriptions-quickstart). ```ts theme={"system"} const subscribers = await pocketsflow.subscriptions.list({ page: 1, pageSize: 20, }); const subscriber = await pocketsflow.subscriptions.get("subscription_id"); ``` ## Plans and entitlements Some features need a paid plan (see [Plans and limits](/concepts/plans-and-limits)). Check what the account can use before you turn one on: ```ts theme={"system"} const entitlements = await pocketsflow.plans.entitlements(); // Same call: pocketsflow.users.entitlements() if (entitlements.features.upsells.allowed) { await pocketsflow.upsells.create({ mainProductIds: [product._id], upsellProductId: "665f1c2a9b3e4a0012ab34ce", upsellPrice: 19, }); } console.log(entitlements.plan, entitlements.feeRate); // "tier2", 0.02 const plans = await pocketsflow.plans.list(); // public catalogue const lost = await pocketsflow.checkout.abandonedSummary(); // { count, amountUsd, windowDays } await pocketsflow.products.setAbandonedCheckout(product._id, true); // Growth ``` > [!NOTE] > > `plans`, `users.entitlements()`, `checkout.abandonedSummary()`, > `products.setAbandonedCheckout()` and `FeatureLockedError` ship in the next > SDK release. Until you can upgrade, call the endpoints directly: > `GET /users/entitlements`, `GET /users/billing-tiers`, > `GET /checkout/abandoned/summary` and > `PATCH /products/{id}/abandoned-checkout` (see the > [endpoint reference](/api-reference/endpoints#plans)). ## Handle errors SDK calls reject when the API returns a non-2xx response: ```ts theme={"system"} try { await pocketsflow.products.get("missing_product"); } catch (error) { console.error("Pocketsflow request failed:", error); } ``` A call that would turn on a feature the account's plan does not include rejects with `FeatureLockedError` (HTTP `403`, code `FEATURE_LOCKED`). Nothing was saved and a retry will fail the same way: ask the creator to upgrade. ```ts theme={"system"} import { FeatureLockedError } from "pocketsflow"; try { await pocketsflow.upsells.create(params); } catch (error) { if (error instanceof FeatureLockedError) { console.log( `Needs the ${error.requiredPlanName} plan — upgrade at ${error.upgradeUrl}`, ); } else { throw error; } } ``` For method signatures, parameter tables, and SDK types, see the [Node.js SDK reference](/api-reference/sdk-reference). For HTTP endpoint details, request schemas, response codes, and webhook events, use the [REST endpoint reference](/api-reference/endpoints) or the [interactive API explorer](https://api.pocketsflow.com/docs). # Node.js SDK reference Source: https://docs.pocketsflow.com/api-reference/sdk-reference Method-by-method reference for the official Pocketsflow Node.js and TypeScript SDK. This page is the method reference for the official [`pocketsflow`](https://www.npmjs.com/package/pocketsflow) package. For installation and a first request, start with the [SDK quickstart](/api-reference/sdk). The SDK is server-side only and is backed by the same API key used by the REST API. It is written in TypeScript and ships its type declarations with every release. ## Client ```ts theme={"system"} import { Pocketsflow } from "pocketsflow"; const pocketsflow = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY!, baseUrl: "https://api.pocketsflow.com", timeout: 30_000, }); ``` ### `PocketsflowConfig` | Property | Type | Required | Default | Description | | - | - | - | - | - | | `apiKey` | `string` | Yes | — | A `pk_live_...` or `pk_test_...` API key. | | `baseUrl` | `string` | No | `https://api.pocketsflow.com` | API origin. Useful for local or staging environments. | | `timeout` | `number` | No | `30000` | Request timeout in milliseconds. | ## Method index | Namespace | Methods | | - | - | | `products` | `list`, `get`, `create`, `update`, `delete`, `copy` | | `variants` | `create`, `delete` | | `orders` | `list`, `get`, `paymentDetails`, `journey` | | `customers` | `list`, `get` | | `reviews` | `list` | | `discounts` | `list`, `get`, `create`, `update`, `delete` | | `upsells` | `list`, `get`, `create`, `update`, `delete` | | `subscriptions` | `list`, `get`, `cancel`, `refund` | | `subscriptionOffers` | `list`, `get`, `create` | | `webhooks` | `list`, `get`, `create`, `update`, `delete`, `test` | | `users` | `me`, `update`, `entitlements`, `updateTrackingPixels`, `updateSellingProfile` | | `checkout` | `create`, `abandonedSummary` | | `refunds` | `list`, `get`, `create` | | `plans` | `entitlements`, `list` | | `payouts` | `status`, `balance`, `list`, `get` | | `penny` | `decide`, `usage` | `products.setAbandonedCheckout`, `users.entitlements`, `users.updateTrackingPixels`, `checkout.abandonedSummary`, the `plans` namespace and `FeatureLockedError` ship in the next SDK release. Until you can upgrade, call their endpoints directly (listed in each section below). ## Products One-time products that buyers can purchase through hosted checkout. | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.products.list()` | `Promise` | | `get` | `pocketsflow.products.get(id)` | `Promise` | | `create` | `pocketsflow.products.create(params)` | `Promise` | | `update` | `pocketsflow.products.update(id, params)` | `Promise` | | `delete` | `pocketsflow.products.delete(id)` | `Promise<{ message: string }>` | | `copy` | `pocketsflow.products.copy(id, params?)` | `Promise` | ```ts theme={"system"} const product = await pocketsflow.products.create({ name: "Premium Course", price: 49.99, description: "A self-paced course.", }); await pocketsflow.products.update(product._id, { name: "Premium Course — Updated", price: 59.99, }); ``` `copy` duplicates a one-time product or a subscription offer, whichever owns the id. Pass `{ testMode: false }` to copy a test-mode item into live mode; omit params to copy within the source's own mode. The copy is named "Name (Copy)" and starts unpublished when copied into live mode. ```ts theme={"system"} const liveCopy = await pocketsflow.products.copy(product._id, { testMode: false, }); ``` ### `CreateProductParams` | Property | Type | Required | Description | | - | - | - | - | | `name` | `string` | Yes | Product name. | | `price` | `number` | Yes | Product price. | | `description` | `string` | No | Product description. | | `subtitle` | `string` | No | Short product subtitle. | | `payWant` | `boolean` | No | Enable pay-what-you-want pricing. | | `minPrice`, `maxPrice` | `number` | No | Bounds for pay-what-you-want pricing. | | `published` | `boolean` | No | Whether the product is published. | | `slug` | `string` | No | Product URL slug. | | `thumbnail` | `string` | No | Thumbnail URL. | | `images` | `string[]` | No | Product image URLs. | | `showSales`, `showReviews` | `boolean` | No | Whether sales and reviews are shown. | | `refundPolicy` | `string` | No | ID of a refund policy (see [Refunds](#refunds)), not the policy text. | | `hasFirstName`, `hasLastName` | `boolean` | No | Collect buyer name fields at checkout. | `update(id, params)` accepts the editable product fields: `name`, `description`, `price`, `currency`, `active`, and `published`. ### `setAbandonedCheckout` | Signature | HTTP | Returns | | - | - | - | | `pocketsflow.products.setAbandonedCheckout(id, enabled)` | `PATCH /products/{id}/abandoned-checkout` | `Promise<{ abandonedCheckoutEnabled: boolean }>` | Turns the recovery email for buyers who leave this product's checkout on or off. Turning it on needs the Growth plan and otherwise throws [`FeatureLockedError`](#errors); turning it off always works. `Product.abandonedCheckoutEnabled` reads the current value (on by default). ## Product variants | Method | Signature | Returns | | - | - | - | | `create` | `pocketsflow.variants.create(params)` | `Promise` | | `delete` | `pocketsflow.variants.delete(id)` | `Promise<{ message: string }>` | ```ts theme={"system"} const variant = await pocketsflow.variants.create({ productId: product._id, name: "Video + workbook", price: 79.99, }); ``` `CreateVariantParams` requires `productId`, `name`, and `price`; `description` is optional. ## Orders | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.orders.list(params?)` | `Promise` | | `get` | `pocketsflow.orders.get(id)` | `Promise` | | `paymentDetails` | `pocketsflow.orders.paymentDetails(id)` | `Promise` | | `journey` | `pocketsflow.orders.journey(id)` | `Promise` | `ListOrdersParams` supports `productId`, `startDate`, `endDate`, `page`, and `pageSize`. The date filter applies only when you pass **both** `startDate` and `endDate`; one bound on its own is ignored. `OrdersResponse` contains `orders` and a `pagination` object. Since SDK 3.5.0, `status` filters like the dashboard's Orders page (`paid`, `refunded`, `disputed` or `failed` for declined payments, one value or an array) and `search` matches the buyer's email. Every order carries its `status` (`OrderStatus`). `paymentDetails(id)` (`GET /orders/{id}/payment-details`) returns the payment's totals, tax, refunds and itemised fees; `journey(id)` (`GET /orders/{id}/journey`) returns the checkout timeline and the card attempts on it. ```ts theme={"system"} const refunds = await pocketsflow.orders.list({ status: "refunded", search: "ana@example.com", }); ``` ```ts theme={"system"} const result = await pocketsflow.orders.list({ page: 1, pageSize: 20, startDate: "2026-01-01", endDate: "2026-01-31", productId: product._id, }); ``` Each order carries its fee breakdown. `platformFee` is the platform fee locked at checkout (in the order currency) and `platformFeeRate` the rate it was charged at: `0.02`, `0.01` on the Volume plan, `0.005` on Volume Max (`null` on legacy sales with no platform line). Use them to reconcile sales after a plan change; a later plan change never rewrites an order. ## Customers | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.customers.list(params?)` | `Promise` | | `get` | `pocketsflow.customers.get(id)` | `Promise` | The API applies `productId`, `sortBy`, and `sortOrder` from `ListCustomersParams`. `sortBy` is `email`, `country`, `numberOfOrders`, or `createdAt`; `sortOrder` is `asc` or `desc`. The list is not paginated: it always returns every matching customer. > [!WARNING] > > `ListCustomersParams` also types `email`, `limit`, and `offset`, but the API > ignores them today. Filter or page the returned array in your own code. ## Reviews | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.reviews.list(params?)` | `Promise` | `list()` returns every review across your products. > [!WARNING] > > `ListReviewsParams` types an optional `productId`, but `GET /reviews` ignores > it and returns every review. Filter by `productId` on the returned array. ```ts theme={"system"} const reviews = (await pocketsflow.reviews.list()).filter( (review) => review.productId === product._id ); ``` ## Discounts | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.discounts.list()` | `Promise` | | `get` | `pocketsflow.discounts.get(id)` | `Promise` | | `create` | `pocketsflow.discounts.create(params)` | `Promise` | | `update` | `pocketsflow.discounts.update(id, params)` | `Promise` | | `delete` | `pocketsflow.discounts.delete(id)` | `Promise<{ message: string }>` | ```ts theme={"system"} const discount = await pocketsflow.discounts.create({ name: "Launch discount", code: "LAUNCH20", value: 20, valueType: "percentage", mainProductIds: [product._id], }); ``` `CreateDiscountParams` requires `name`, `code`, `value`, and `mainProductIds`. `valueType` is `percentage` or `fixed`; `active` is optional. The update type makes all fields optional. > [!WARNING] > > The SDK types also accept `expiration`, but the API does not store it on > create or update, so the discount stays valid until you deactivate or delete > it. Set `active: false` when a promotion ends. ## Upsells | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.upsells.list()` | `Promise` | | `get` | `pocketsflow.upsells.get(id)` | `Promise` | | `create` | `pocketsflow.upsells.create(params)` | `Promise` | | `update` | `pocketsflow.upsells.update(id, params)` | `Promise` | | `delete` | `pocketsflow.upsells.delete(id)` | `Promise<{ message: string }>` | `CreateUpsellParams` requires `mainProductIds`, `upsellProductId`, and `upsellPrice`. Optional fields include `name`, `offer`, `upsellDescription`, `primaryButtonText`, `secondaryButtonText`, and `active`. ## Subscription offers Subscription offers are the recurring products you sell. They are distinct from buyer subscriptions in the `subscriptions` namespace. | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.subscriptionOffers.list()` | `Promise` | | `get` | `pocketsflow.subscriptionOffers.get(id)` | `Promise` | | `create` | `pocketsflow.subscriptionOffers.create(params)` | `Promise` | ```ts theme={"system"} const offer = await pocketsflow.subscriptionOffers.create({ name: "Pro Membership", price: 29, frequency: "monthly", trialPeriod: 7, }); ``` ### `CreateSubscriptionOfferParams` | Property | Type | Required | Description | | - | - | - | - | | `name` | `string` | Yes | Offer name. | | `price` | `number` | Yes | Recurring price in USD. | | `frequency` | `weekly \| monthly \| yearly` | Yes | Billing interval. | | `subtitle`, `description` | `string` | No | Offer copy. | | `trialPeriod` | `number` | No | Trial duration in days. | | `published` | `boolean` | No | Whether the offer is published. | | `redirectBackUrl`, `slug` | `string` | No | Billing portal return URL and offer slug. | | `thumbnail` | `string` | No | Thumbnail URL. | | `images` | `string[]` | No | Offer image URLs. | | `isFile`, `hasFirstName`, `hasLastName`, `hasProductPage`, `showSales`, `showReviews`, `hasCallbackUrl` | `boolean` | No | Offer and checkout behavior flags. | | `file`, `url`, `callbackUrl` | `string \| object` | No | File, external URL, and callback settings. | | `checkoutText`, `portalText`, `privacyPolicy`, `termsOfService`, `refundPolicy`, `ctaText`, `thankYouText` | `string` | No | Checkout, portal, and policy copy. | | `maxPrice`, `minPrice` | `number` | No | Pay-what-you-want bounds. | | `design`, `colors`, `pageStyle`, `checkoutStyle`, `checkoutColors` | `Record` | No | Advanced presentation configuration. | `frequency` must be `weekly`, `monthly`, or `yearly`. ## Buyer subscriptions The `subscriptions` namespace manages buyer memberships. Use `subscriptionOffers` to manage the recurring products themselves. | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.subscriptions.list(params?)` | `Promise` | | `get` | `pocketsflow.subscriptions.get(id)` | `Promise` | > [!WARNING] > > The legacy SDK helpers `subscriptions.cancel(id)` and `subscriptions.refund(id)` > called the retired card-subscription routes and no longer work (they return > `404`). To cancel (at period end), pause, or resume a subscriber, call [`POST > /subscriptions/{id}/cancel`](/api-reference/endpoints#subscriptions) (or > `/pause`, `/resume`) with the subscriber `_id` or membership id (`mem_…`). > Issue refunds from the dashboard. `ListSubscriptionsParams` supports `status`, `startDate`, `endDate`, `page`, and `pageSize`. The current SDK list method uses the legacy subscription-customer endpoint; the canonical REST subscriber catalog is [`GET /subscriptions/subscribers`](/api-reference/endpoints#subscriptions). ## Webhooks | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.webhooks.list()` | `Promise` | | `get` | `pocketsflow.webhooks.get(id)` | `Promise` | | `create` | `pocketsflow.webhooks.create(params)` | `Promise` | | `update` | `pocketsflow.webhooks.update(id, params)` | `Promise` | | `delete` | `pocketsflow.webhooks.delete(id)` | `Promise<{ message: string }>` | | `test` | `pocketsflow.webhooks.test(id)` | `Promise<{ message: string }>` | ```ts theme={"system"} const webhook = await pocketsflow.webhooks.create({ url: "https://example.com/webhooks/pocketsflow", events: ["order.completed", "invoice.payment_succeeded"], description: "Order and billing events", }); await pocketsflow.webhooks.test(webhook._id); ``` `CreateWebhookParams` requires an HTTPS `url` and an `events` array. The SDK exports the `WebhookEvent` union for typed event names. > [!WARNING] > > The current SDK `webhooks.update` implementation uses `PUT`, while the public > REST endpoint is `PATCH /webhooks/{id}`. Use the REST endpoint for updates > until the SDK method is aligned in a follow-up release. ## Users | Method | Signature | Returns | | - | - | - | | `me` | `pocketsflow.users.me()` | `Promise` | | `update` | `pocketsflow.users.update(params)` | `Promise` | `UpdateUserParams` supports `firstName`, `lastName`, `currency`, `country`, `subdomain`, and `contactEmail`. | Method | Signature | HTTP | Returns | | - | - | - | - | | `entitlements` | `pocketsflow.users.entitlements()` | `GET /users/entitlements` | `Promise` | | `updateTrackingPixels` | `pocketsflow.users.updateTrackingPixels(params)` | `POST /users/update` | `Promise` | | `updateSellingProfile` | `pocketsflow.users.updateSellingProfile(params)` | `PUT /users/selling-profile` | `Promise` | `updateSellingProfile` records what the creator sells (`sellingPath`: `digital`, `membership`, `software` or `other`) and where buyers pay (`sellingSetup`: `pages` or `code`), the answers `users.me()` returns; `null` clears one (SDK 3.4.0). `users.entitlements()` is the same call as [`plans.entitlements()`](#plans). `updateTrackingPixels` sets or removes the ad-platform ids on your buyer pages (`facebookPixel`, `googlePixel`, `googleTagManager`, `tiktokPixel`, `pinterestTag`, `snapchatPixel`, `twitterPixel`, `twitterPurchaseEventId`, `linkedinPartnerId`, `linkedinConversionId`, `redditPixel`, `microsoftUetTag`); `""` or `null` removes one. Adding or changing a pixel needs the Starter plan and otherwise throws `FeatureLockedError`. ## Plans | Method | Signature | HTTP | Returns | | - | - | - | - | | `entitlements` | `pocketsflow.plans.entitlements()` | `GET /users/entitlements` | `Promise` | | `list` | `pocketsflow.plans.list()` | `GET /users/billing-tiers` | `Promise` | ```ts theme={"system"} const { plan, feeRate, features } = await pocketsflow.plans.entitlements(); if (!features.abandonedCheckout.allowed) { console.log(`Needs ${features.abandonedCheckout.requiredPlanName}`); } ``` | `Entitlements` field | Type | Description | | - | - | - | | `plan` | `PlanId` | Active plan: `free`, `tier1`, `tier2`, `tier3`, `tier4`, `volume`, `volume_max`, `enterprise`. | | `planName` | `string` | Display name, e.g. `Growth`. | | `billingInterval` | `"month" \| "year"` | How the plan is billed. | | `feeRate` | `number` | Platform fee on new sales (`0.02`, `0.01` on Volume, `0.005` on Volume Max). | | `seats` | `number \| null` | Team seats; `null` is unlimited. | | `enforced` | `boolean` | Whether pre-existing features are plan-gated yet. | | `features` | `Record` | `{ allowed, requiredPlan, requiredPlanName, reason, grandfatheredUntil }` per key. | `plans.list()` calls a public endpoint (the API does not need the key for it) and returns every self-serve plan: `plan`, `name`, `pricePerMonth`, `pricePerYear`, `feeRate`, `seats`, subscriber and email caps, `maxUploadMb` and `features` (the feature keys it includes). Plans are bought in the dashboard only. See [Plans and limits](/concepts/plans-and-limits). ## Checkout Create a hosted checkout session for either a one-time product or a subscription offer. ```ts theme={"system"} const session = await pocketsflow.checkout.create({ productId: offer._id, successUrl: "https://example.com/success", cancelUrl: "https://example.com/cancel", customerEmail: "buyer@example.com", discountCode: "LAUNCH20", metadata: { source: "pricing-page" }, }); console.log(session.url); ``` The SDK's `CreateCheckoutParams` type requires `productId`, `successUrl`, and `cancelUrl` (the HTTP API itself only requires `productId`). Optional fields are `customerEmail`, `discountCode`, and `metadata`. ### `abandonedSummary` | Signature | HTTP | Returns | | - | - | - | | `pocketsflow.checkout.abandonedSummary()` | `GET /checkout/abandoned/summary` | `Promise<{ count: number; amountUsd: number; windowDays: number }>` | Live checkouts lost over the last 30 days (the buyer typed their details and never paid), once per buyer and product. `amountUsd` sums the USD checkouts only. Readable on every plan. ## Refunds | Method | Signature | Returns | | - | - | - | | `list` | `pocketsflow.refunds.list()` | `Promise` | | `get` | `pocketsflow.refunds.get(id)` | `Promise` | | `create` | `pocketsflow.refunds.create(params)` | `Promise` | The API behind `refunds` manages **refund policies**: the terms shown to buyers at checkout, which products reference by id (`refundPolicy`). A policy has `name`, `policy` (the text), `period`, and `periodType` (`days` or `weeks`). > [!WARNING] > > The SDK's `Refund` / `CreateRefundParams` types describe order refunds > (`orderId`, `amount`, `reason`). The API does not process them: those fields > are dropped and no payment is refunded. Refund a payment from the dashboard. > Use `list()` and `get(id)` to read your refund policies. ## Payouts Read only, since SDK 3.5.0: withdrawing money stays in the dashboard. | Method | Signature | Returns | | - | - | - | | `status` | `pocketsflow.payouts.status()` | `Promise` | | `balance` | `pocketsflow.payouts.balance()` | `Promise` | | `list` | `pocketsflow.payouts.list(params?)` | `Promise` | | `get` | `pocketsflow.payouts.get(id)` | `Promise` | `status()` (`GET /payouts/status`) says whether payouts are on (`payoutsEnabled`) and, if not, why (`state`: `not_connected`, `setup_required`, `identity_verification_required`, `information_requested`, `in_review` or `on_hold`), with a `message` and the dashboard page to act on (`actionUrl`). `balance()` calls `GET /payouts/balances`. `list({ status?, limit? })` (`GET /payouts`, `limit` 1-50, default 20) returns `{ data, hasMore }`, newest first; each `Payout` has `status` (`requested`, `awaiting_payment`, `in_transit`, `completed`, `failed`, `canceled` or `denied`), `amount`, `feeAmount`, `netAmount`, `currency`, `estimatedArrival` and, when it did not go through, `failureMessage`. The `payout.created` and `payout.updated` webhook events carry the same `Payout`. ```ts theme={"system"} const status = await pocketsflow.payouts.status(); if (!status.payoutsEnabled) console.log(status.message, status.actionUrl); const { data } = await pocketsflow.payouts.list({ status: "in_transit" }); ``` ## Penny [Pocketsflow Penny 1](/api-reference/penny), the decision model. Since SDK 3.6.0. API keys only. | Method | Signature | Returns | | - | - | - | | `decide` | `pocketsflow.penny.decide(params)` | `Promise` | | `usage` | `pocketsflow.penny.usage()` | `Promise` | `decide` calls `POST /v1/penny/decide`; `usage` calls `GET /v1/penny/usage`. ### `PennyDecideParams` | Field | Type | Required | Description | | - | - | - | - | | `state` | `string \| Record` | Yes | The situation. At most 8,000 characters (objects after 2-space JSON). | | `question` | `string` | Yes | One question about the state, at most 500 characters. | | `type` | `"choice" \| "yes_no" \| "score"` | Yes | `score` is 1 (lowest) to 5 (highest); say in the question what 1 and 5 mean. | | `options` | `string[]` | `choice` only | 2 to 8 single-line options of at most 120 characters. Not allowed otherwise. | ### `PennyDecision` `model` (`"pocketsflow-penny-1"`), `type`, `confidence` (0-1), `probs` (one per answer), `auto` (safe to act without a person) and `usage` (`free_remaining`, `credits_remaining`). Plus the answer for the type: `choice` and `index` (`choice`), `yes` (`yes_no`) or `score` (`score`, 1-5). `PennyUsage` has `free_limit`, `free_used`, `free_remaining`, `credits_remaining` (`null` when unreadable) and `buy_url` (`null` when credits are not on sale). When the month's free decisions and your credits are used up, `decide` rejects with a `PocketsflowError` with `status` `402`; `error.body.error` is `penny_credits_exhausted` and `error.body.buy_url` links to more credits. ## Errors Failed requests reject with `PocketsflowError`: ```ts theme={"system"} import { Pocketsflow, PocketsflowError } from "pocketsflow"; try { await pocketsflow.products.get("missing_product"); } catch (error) { if (error instanceof PocketsflowError) { console.error(error.message, error.status, error.code); } } ``` | Property | Type | Description | | - | - | - | | `message` | `string` | Human-readable error message. | | `status` | `number \| undefined` | HTTP status code, when available. | | `code` | `string \| undefined` | API or client error code, when available. | The SDK also maps request timeouts to a `PocketsflowError` with code `TIMEOUT`. ### `FeatureLockedError` A `403` with code `FEATURE_LOCKED` rejects with `FeatureLockedError`, a subclass of `PocketsflowError`: the call would turn on a feature the account's plan does not include. Nothing was saved and retrying fails the same way. | Property | Type | Description | | - | - | - | | `code` | `string` | Always `FEATURE_LOCKED`. | | `status` | `number` | Always `403`. | | `feature` | `string` | The feature key, e.g. `upsells`. | | `requiredPlan` | `string` | The cheapest plan that includes it, e.g. `tier2`. | | `requiredPlanName` | `string` | Its display name, e.g. `Growth`. | | `details` | `object` | The full `details` body, including `requiredPlanPrice`. | | `upgradeUrl` | `string` | `https://app.pocketsflow.com/profile/billing` | ```ts theme={"system"} import { FeatureLockedError } from "pocketsflow"; try { await pocketsflow.products.setAbandonedCheckout(product._id, true); } catch (error) { if (error instanceof FeatureLockedError) { console.log(`Upgrade to ${error.requiredPlanName}: ${error.upgradeUrl}`); } } ``` ## TypeScript types The package exports the request and response types used by every method, including `Product`, `Order`, `Customer`, `SubscriptionOffer`, `Webhook`, `CheckoutSession`, `Refund`, `Entitlements`, `Plan`, `PlanId`, `FeatureKey`, and all `Create*Params`, `Update*Params`, and list parameter types. Import them as type-only imports: ```ts theme={"system"} import type { CreateProductParams, Product, SubscriptionOffer, } from "pocketsflow"; ``` For the corresponding HTTP operation, request body, response codes, and full schema, see the [REST endpoint reference](/api-reference/endpoints) or open the [interactive API explorer](https://api.pocketsflow.com/docs). # Search API Source: https://docs.pocketsflow.com/api-reference/search One query across your orders, customers, products, subscribers and discounts. The same search as ⌘K in the dashboard. `GET /search` looks for one piece of text everywhere in your store and returns the matches grouped by type. It is the search behind **⌘K** (Ctrl+K on Windows and Linux) in the dashboard, so an integration or an AI agent finds a record the same way you do. Base URL `https://api.pocketsflow.com`, API key in the `Authorization` header, like every other endpoint. Available on every plan. ## Search ```bash theme={"system"} curl "https://api.pocketsflow.com/search?q=ana&limit=5" \ -H "Authorization: Bearer pk_live_..." ``` ```json theme={"system"} { "query": "ana", "testMode": false, "limit": 5, "groups": [ { "type": "orders", "hasMore": false, "hits": [ { "id": "6711a3d59e3f1a0012cd7788", "type": "orders", "title": "Ana Lopez", "subtitle": "Notion course · ana@example.com · #12CD7788", "meta": { "amount": 49, "currency": "USD", "status": "paid", "date": "2026-10-12T09:30:00.000Z" }, "path": "/orders-one-time/6711a3d59e3f1a0012cd7788", "image": null, "match": "email" } ] }, { "type": "customers", "hasMore": false, "hits": [] }, { "type": "products", "hasMore": false, "hits": [] }, { "type": "subscriptions", "hasMore": false, "hits": [] }, { "type": "discounts", "hasMore": false, "hits": [ { "id": "6711a3d59e3f1a0012cd7701", "type": "discounts", "title": "ANA20", "subtitle": "Ana's friends", "meta": { "value": 20, "valueType": "percentage", "status": "active", "date": "2026-10-01T10:00:00.000Z" }, "path": "/discounts/6711a3d59e3f1a0012cd7701", "image": null, "match": "code" } ] } ] } ``` | Parameter | Required | Notes | | - | - | - | | `q` | yes | What to look for. Cut to 100 characters. One character returns empty groups. | | `types` | no | Comma-separated: `orders`, `customers`, `products`, `subscriptions`, `discounts`. Default: all of them. An unknown type answers `400`. | | `limit` | no | Hits per type, 1 to 20. Default `5`. | ## What it matches | Type | Matches | | - | - | | `orders` | The start of the buyer's email, the buyer's first or last name, the order id (full, with or without `#`, or its first 6+ characters) and the amount (`49` finds 49.00 to 49.99, `49.99` finds exactly that). Subscription payments are not orders here; find them under `subscriptions`. | | `customers` | The start of the email, first name or last name (`ana lo` = first name `ana…`, last name `lo…`), and the id. | | `products` | Any word of a product or subscription-offer name (`course` finds "Notion course"), the start of a product's slug, and the id. `meta.kind` says `product` or `subscription`. | | `subscriptions` | Subscribers: the start of their email, their name, and the name of the offer they are on. | | `discounts` | The start of the code, any word of the discount name, and the id. | Matching ignores case. Text is matched literally: `a.b+c` finds the email `a.b+c@example.com` and nothing else. Each group lists up to `limit` hits, an id match first, then newest first. `hasMore: true` means more records match: use the list endpoints (`GET /orders`, `GET /customers`, …) with their filters to page through them. ## The hit | Field | Notes | | - | - | | `id` | Pass it to the matching get endpoint (`GET /orders/{id}`, `GET /customers/{id}`, `GET /products/{id}`, `GET /discounts/{id}`). | | `title` / `subtitle` | What the dashboard shows: the buyer's name or email, the product name, the discount code. | | `meta` | `amount` and `currency` (major units: `49.99` is \$49.99), `status`, `date`, and per type `interval`, `kind`, `value` / `valueType`, `country`. | | `path` | Opens the record in the dashboard: `https://app.pocketsflow.com` + `path`. | | `match` | What matched: `id`, `email`, `name`, `amount`, `code`, `slug`, or `product` (a subscriber of an offer whose name matched). | ## Test mode A `pk_test_` key searches your test data, a `pk_live_` key your live data. `testMode` in the answer says which. ## Team members In the dashboard a team member searches the store they work on, and only gets the types of the areas their teams have: **Orders, customers and refunds** gives `orders`, `customers` and `subscriptions`; **Products and store design** gives `products`; **Discounts, upsells and affiliates** gives `discounts`. Owners and admins get everything. ## Limits 120 searches per minute per account, on top of the general 600 requests per minute. Past it the API answers `429` with `code: "RATE_LIMITED"`. ## MCP AI agents connected through the [MCP server](/api-reference/mcp-server) call the same search as the `search_store` tool. # Audience segments Source: https://docs.pocketsflow.com/api-reference/segments Save rule-based groups of your email contacts, count them live, and send posts to them. Growth plan and above. A **segment** is a saved set of rules over your email contacts — what they bought, how much they spent, when they last bought, opened or clicked, their tags, country and how they subscribed. Segments are evaluated **live**: a count, a member list or a send always uses the rules at that moment, so "bought in the last 30 days" means the 30 days before the email goes out. > [!NOTE] > > Segments are on the **Growth** plan and above. On other plans every > segment endpoint answers `403` with `code: FEATURE_LOCKED` and > `details.requiredPlan: "tier2"` — API keys and MCP included. ## Endpoints | Method | Path | What it does | | - | - | - | | `GET` | `/newsletters/segments` | List segments (`page`, `pageSize` up to 100) | | `POST` | `/newsletters/segments` | Create a segment | | `POST` | `/newsletters/segments/preview` | Count an unsaved definition (with 5 sample rows) | | `GET` | `/newsletters/segments/{id}` | Get one segment | | `POST` | `/newsletters/segments/{id}` | Update name, description, rules or smart tag | | `DELETE` | `/newsletters/segments/{id}` | Delete it (its smart tag is taken back) | | `GET` | `/newsletters/segments/{id}/count` | Live count of active contacts | | `GET` | `/newsletters/segments/{id}/subscribers` | Members, cursor-paginated (`limit`, `after`) | ## Definition Rules sit in **groups**. Rules inside a group combine with the group's `match`; groups combine with the top-level `match` — `all` is AND, `any` is OR. Up to 10 groups of 20 rules. ```json theme={"system"} { "match": "any", "groups": [ { "match": "all", "rules": [ { "type": "bought", "productId": "665f1c2a9b3e4a0012ab34cd" }, { "type": "spent", "op": "gt", "amountCents": 5000 } ] }, { "rules": [{ "type": "tag", "tag": "vip" }] } ] } ``` This is "(bought the course **and** spent more than \$50) **or** tagged vip". | `type` | Fields | Matches | | - | - | - | | `bought` | `productId` | Bought this product or subscription | | `notBought` | `productId` | Never bought it (includes people who never bought) | | `spent` | `op` (`gt` / `lt`), `amountCents` | Total spent in your live store, in your account currency | | `boughtWithin` | `days` | Last purchase within the last N days | | `notBoughtWithin` | `days` | Past buyers whose last purchase is older than N days | | `engagedWithin` | `days`, `event` (`opened`/`clicked`/`any`) | Opened or clicked one of your emails in the last N days | | `tag` / `notTag` | `tag` | Carries (or not) this tag, exact match (tags you add on a customer's CRM page are contact tags too) | | `country` | `countries` (ISO codes) | Billing country of their latest purchase | | `source` | `form`, `checkout`, `import`, `dashboard`, `api`, `recommendation` | How they joined your list (`recommendation`: another creator's newsletter recommendation) | Purchase totals are rebuilt from your sales every night (and a new purchase moves "last purchase" right away). Contacts added before segments shipped have no `source`. ## Count a segment before saving it ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/newsletters/segments/preview \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "definition": { "groups": [{ "rules": [{ "type": "notBoughtWithin", "days": 90 }] }] } }' ``` ```json theme={"system"} { "count": 214, "sample": [{ "_id": "…", "email": "ann@example.com", "name": "Ann" }], "computedAt": "2026-10-16T12:00:00.000Z" } ``` ## Smart tags Give a segment a `smartTag` and every member carries that tag. It is refreshed every night: new members get it, people who left the segment lose it — only where the segment added it, so a tag you typed by hand is never removed. One smart tag per segment, each tag used by one segment (`409` otherwise). The dashboard offers three to start: `customer`, `vip` (spent over \$200) and `lapsed` (no purchase in 90 days). ## Send a post to a segment Set `segmentId` on `POST /newsletters/posts` (or update a post with it), then send or schedule it as usual. The segment's rules are evaluated when the post goes out. A deleted segment, or a plan that no longer includes segments, leaves the post with no audience: it fails instead of sending to someone else. Automations can use segments too: limit a trigger to a segment, or branch on **Is in segment** in a condition. ## MCP AI agents get `list_segments`, `create_segment`, `get_segment`, `get_segment_count` and `preview_segment`. See [MCP server](/api-reference/mcp-server). # Send email Source: https://docs.pocketsflow.com/api-reference/send-email Send transactional or one-off emails to your audience programmatically with POST /newsletters/send. Send an email to up to **100 recipients** in a single request. Emails are delivered with your configured sender name, reply-to address, footer, physical address, and an unsubscribe link — the same conventions as newsletters sent from the dashboard — and each send is recorded in your account as a sent post (marked `source: api`) with delivery events and usage tracking. > [!NOTE] > > **Sender verification required.** You must verify your sender email in > **Newsletters → Settings** before using this endpoint. Unverified senders > receive a `403` with error code `EMAIL_SENDER_NOT_VERIFIED`. ## Endpoint ``` POST https://api.pocketsflow.com/newsletters/send ``` Authenticate with your API key as a Bearer token (`pk_live_…` or `pk_test_…`). See [API reference](/api-reference/introduction) for how to create a key. ## Request body | Field | Type | Required | Description | | - | - | - | - | | `to` | string or string\[] | Yes | A recipient email address, or an array of 1–100 addresses. | | `subject` | string | Yes | Email subject line. | | `html` | string | Yes\* | HTML body of the email. \*Required unless `text` is provided. | | `text` | string | No | Plain-text body. If `html` is omitted, a simple HTML body is generated from it. | | `fromName` | string | No | Sender display name. Defaults to your newsletter settings' default from name. | | `replyTo` | string | No | Reply-to address. Defaults to your configured reply-to (or sender) email. | | `preview` | string | No | Inbox preview text. | ## Example request ```bash theme={"system"} curl https://api.pocketsflow.com/newsletters/send \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "to": ["customer@example.com"], "subject": "Your weekly update", "html": "

Hi there — here is what is new this week.

", "fromName": "Acme Studio", "replyTo": "hello@acme.com" }' ``` Send to many recipients at once (max 100), or send a plain-text email: ```bash theme={"system"} # Up to 100 recipients in a single call curl https://api.pocketsflow.com/newsletters/send \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "to": ["a@example.com", "b@example.com", "c@example.com"], "subject": "Doors are open", "text": "The cohort is live — reply if you have any questions.", "preview": "Your spot is ready" }' ``` ## Example response ```json theme={"system"} { "id": "665f1c2e8b3735856be339aa", "accepted": ["customer@example.com"], "skipped": ["unsubscribed@example.com"], "skippedCount": 1, "status": "sent" } ``` | Field | Description | | - | - | | `id` | ID of the email post recorded for this send (`null` when every recipient was skipped). | | `accepted` | The recipients the email was successfully sent to. | | `skipped` | Recipients who unsubscribed from you, or whose address hard-bounced or reported spam (see [Deliverability protection](#deliverability-protection)). They are never emailed and don't count toward your send allowance. | | `skippedCount` | Number of skipped recipients. | | `status` | `"sent"`, or `"skipped"` when every recipient had unsubscribed (nothing is sent or charged; the response is still `200`). | ## Errors | Status | Error | Meaning | | - | - | - | | `400` | message in `error` | Validation failed — invalid recipient, more than 100 recipients, missing `subject`, or missing both `html` and `text`. | | `401` | — | Missing or invalid API key. | | `402` | `SEND_ALLOWANCE_EXCEEDED` (in `code`) | The send would exceed your plan's monthly email allowance. | | `403` | `EMAIL_SENDER_NOT_VERIFIED` | Your sender email is not verified yet. | | `403` | `SELLER_BLOCKED` | Your account is restricted from sending email. | | `403` | `EMAIL_SENDING_PAUSED` (in `error` and `code`) | Email sending on your account is paused after too many bounces or spam reports. Contact support. Your store, checkout and payouts keep working. | | `429` | `DAILY_SEND_LIMIT` (in `code`) | New-sender daily limit reached (see below). The body adds `sentToday`, `dailyLimit`, `remaining` and `projected`. A `429` without a `code` is the API rate limit. | | `502` | `EMAIL_SEND_FAILED` | No emails could be delivered. Retry later. | ## Behavior & limits * **Recipients:** provide a single address or an array of **1–100**. Addresses are normalized to lowercase and de-duplicated before sending. More than 100 returns `400`. * **Body:** provide `html`, `text`, or both. If only `text` is given, a simple HTML body is generated from it; `text` is always used as the plain-text alternative for better deliverability. * **Sender identity:** `fromName` and `replyTo` default to your Newsletter settings when omitted. The sending address must be a **verified** sender. * **Compliance:** every email automatically includes your footer, physical address, and a per-recipient unsubscribe link — you don't add these yourself. * **Recording & usage:** each send is stored as a post (`source: api`) and counts toward your email usage (`totalEmailsSent`). * **Idempotency:** the endpoint does not de-duplicate across separate calls — guard against accidental double-sends on your side (for example, key retries on your own request id). ## Deliverability protection Every Pocketsflow creator sends from the same shared address, so the API applies the same protections as the dashboard, scheduled sends, automations and the [MCP server](/api-reference/mcp-server). You don't need to set up a webhook for any of this. * **Bounced and spam-reporting addresses are skipped.** An address that hard-bounced, or whose owner marked an email from any Pocketsflow creator as spam, is never emailed again. It comes back in `skipped`, isn't sent and isn't charged. On your own list the contact's status becomes `bounced` or `complained`. * **New senders have a daily limit.** For the first 14 days, and until your account has sent 1,000 emails, you can send up to **1,000 emails per day** (00:00 to 00:00 UTC) across the API, campaigns, automations and test sends. Over the limit, the request is refused with `429` and `code: "DAILY_SEND_LIMIT"`, and nothing is sent. * **High bounce or complaint rates pause sending.** Once your account has sent enough email for the numbers to mean something (500 or more in the last 30 days), a hard-bounce rate above 5% or a spam-complaint rate above 0.3% (the limit Gmail and Yahoo set for bulk senders) pauses email sending on your account. Every send is then refused with `403` and `error: "EMAIL_SENDING_PAUSED"`, and scheduled posts go back to draft. Only email is paused: your store, checkout and payouts keep working. We email you when this happens; contact support to get sending again. ```json theme={"system"} { "error": "EMAIL_SENDING_PAUSED", "code": "EMAIL_SENDING_PAUSED", "message": "Email sending on your account is paused while we review recent bounces and spam reports. Your store, checkout and payouts are not affected. Contact support and we'll help you get sending again." } ``` ## Notes * This endpoint shares the `/newsletters` surface; to publish a full newsletter post to all subscribers instead, use [`POST /newsletters/posts/{id}/send`](/api-reference/introduction#newsletters). * The full OpenAPI definition is available in the [interactive API reference](https://api.pocketsflow.com/docs). ## Related topics * [API reference](/api-reference/introduction) * [MCP server](/api-reference/mcp-server) — call this as the `send_email` tool. # Signup forms Source: https://docs.pocketsflow.com/api-reference/signup-forms Create signup forms and popups, read their numbers, and sign people up from your own markup. A signup form is an inline form, slide-in or popup that creators embed on their own sites with one script tag. The API manages forms and reads their stats; two public endpoints serve the embed. Product guide: [Signup forms](/selling/signup-forms). > [!NOTE] > > Growth plan and above. `POST /forms` and editing with `PATCH /forms/{id}` > answer `403` with `code: FEATURE_LOCKED` (and `details.requiredPlan`) on a > plan without forms. Listing, reading, pausing (`status: "paused"`), > archiving and deleting stay open. ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/forms` | `listSignupForms` | `list_signup_forms` | | `POST` | `/forms` | `createSignupForm` | `create_signup_form` | | `GET` | `/forms/{id}` | `getSignupForm` | `get_signup_form` | | `PATCH` | `/forms/{id}` | `updateSignupForm` | `update_signup_form` | | `DELETE` | `/forms/{id}` | `deleteSignupForm` | `delete_signup_form` | | `GET` | `/forms/public/{id}` | `getPublicSignupForm` | — (public) | | `POST` | `/forms/public/{id}/subscribe` | `subscribeWithSignupForm` | — (public) | ## Create a form ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/forms \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "name": "Blog exit popup", "type": "popup", "headline": "Wait, take the playbook with you", "buttonLabel": "Send it to me", "tags": ["blog"], "doubleOptIn": true, "trigger": { "exitIntent": true, "delaySeconds": 10 }, "frequencyDays": 7 }' ``` The response is the form with `stats` (`views`, `signups`, `conversionRate` in percent) and `embed.script` / `embed.iframe`, ready to paste. `GET /forms/{id}` adds `daily`: views and signups per UTC day for the last 30 days. | Field | Type | Notes | | - | - | - | | `name` | string ≤ 80 | Required on create. Only you see it. | | `type` | `inline` \| `slide_in` \| `popup` | Default `inline`. | | `status` | `active` \| `paused` | A paused form renders nothing. | | `headline`, `body`, `buttonLabel`, `placeholder` | string | Default copy per type when omitted. | | `collectName` | boolean | Ask for a first name too. | | `successHeadline`, `successMessage` | string | The thank-you state. | | `leadMagnetProductId` | string \| null | One of your products, linked after signup. | | `tags` | string\[] ≤ 10 | Added to everyone who signs up. | | `doubleOptIn` | boolean | Confirmation email before joining. | | `accentColor` | `#rrggbb` | Button colour. | | `position` | `bottom_right` \| `bottom_left` | Slide-in corner. | | `trigger` | `{ delaySeconds 0–120, scrollPercent 0–100, exitIntent }` | When a slide-in or popup shows. | | `frequencyDays` | 0–365 | Days before showing again to someone who closed it. | ## Your own markup Build your own form and post to the public endpoint (no API key, any origin, 10 signups per 15 minutes per IP): ```js theme={"system"} await fetch(`https://api.pocketsflow.com/forms/public/${formId}/subscribe`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, name, company: "", elapsedMs }), }); // → { "status": "subscribed", "leadMagnet": { "name": "…", "url": "…" } } // → { "status": "confirm_email" } with double opt-in ``` `company` is a honeypot (leave it empty) and `elapsedMs` is how long the form was on screen; a filled honeypot or a submit under 1.5 seconds gets a success answer and is ignored. The answer never says whether the address was already subscribed. ## SDK ```ts theme={"system"} const forms = await pocketsflow.signupForms.list(); const form = await pocketsflow.signupForms.create({ name: "Footer", type: "inline", tags: ["blog"] }); await pocketsflow.signupForms.update(form._id, { status: "paused" }); ``` # Subscription retention API Source: https://docs.pocketsflow.com/api-reference/subscription-retention Read recovered revenue, at-risk subscriptions and the saved-subscriptions report, and configure recovery, save offers and intro pricing with an API key. The retention endpoints live under `/subscription-retention`. They use your API key like every other endpoint and work in the key's mode (live or test). Reads are open on every plan; writes that **turn a feature on** need the **Pro** plan and otherwise answer `403` with `code: "FEATURE_LOCKED"` and `details.requiredPlan`. Turning a feature off is always allowed. | Method | Path | What it does | | - | - | - | | `GET` | `/subscription-retention/recovery/summary?days=30` | Recovered revenue, at-risk amount, recovery rate | | `GET` | `/subscription-retention/recovery/at-risk?status=open` | Failed renewals (`open`, `recovered` or `closed`), paginated | | `GET` | `/subscription-retention/recovery/settings` | Recovery settings | | `PUT` | `/subscription-retention/recovery/settings` | Change `enabled`, `finalAction`, `emailBuyer` | | `GET` | `/subscription-retention/save-offers/report?days=30` | Saved subscriptions, reasons, recent flows | | `GET` | `/subscription-retention/intro/report` | Intro pricing and yearly switch counts | | `GET` | `/subscription-retention/offers` | Retention settings of every subscription offer | | `GET` | `/subscription-retention/offers/{id}` | One offer's settings | | `PUT` | `/subscription-retention/offers/{id}` | Change `saveOffers`, `intro`, `yearlySwitch` | Money is decimal major units (`29.99`), never cents. Amounts are reported per currency and never summed across currencies. ## Recovery summary ```bash theme={"system"} curl https://api.pocketsflow.com/subscription-retention/recovery/summary?days=30 \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" ``` ```json theme={"system"} { "days": 30, "recovered": [{ "currency": "usd", "amount": 412, "count": 9 }], "recoveredCount": 9, "atRisk": [{ "currency": "usd", "amount": 87, "count": 3 }], "atRiskCount": 3, "lostCount": 2, "recoveryRate": 81.8, "entitlement": { "allowed": true, "requiredPlan": "tier3" } } ``` ## Recovery settings ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/subscription-retention/recovery/settings \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "finalAction": "pause" }' ``` `finalAction` is what happens one day after the last retry (day 7) when the renewal is still unpaid: `cancel`, `pause` (the unpaid renewal is voided, access is kept) or `keep`. ## Per-offer settings ```bash theme={"system"} curl -X PUT https://api.pocketsflow.com/subscription-retention/offers/665f1c2a9b3e4a0012ab34cd \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "saveOffers": { "enabled": true, "pauseMaxMonths": 2, "discountPercent": 30, "discountMonths": 3 }, "intro": { "enabled": true, "price": 1, "periods": 1 }, "yearlySwitch": { "enabled": true, "afterPayments": 3, "percentOff": 15 } }' ``` | Field | Rules | | - | - | | `saveOffers.pauseMaxMonths` | 1–3 | | `saveOffers.discountPercent` | 5–90, whole numbers | | `saveOffers.discountMonths` | 1–12 payments | | `intro.price` | at least `1.00` and lower than the regular price; not with a free trial | | `intro.periods` | 1–12 | | `yearlySwitch.afterPayments` | 1–24; monthly offers only | | `yearlySwitch.percentOff` | 1–50 | An invalid value answers `400` with `code: "INVALID_RETENTION_CONFIG"`, a readable `message` and the offending `field` (for example `intro.price`). ## Events | Event | When | | - | - | | `subscription.payment_failed` | A renewal failed and recovery started, and on each later failed attempt | | `subscription.recovered` | A failed renewal was paid after all | | `subscription.saved` | A subscriber accepted a pause or a discount instead of canceling | Payloads are on the [webhook events](/api-webhooks/events#subscription-payment-failed) page. In MCP the same operations are the tools `get_recovery_summary`, `list_at_risk_subscriptions`, `get_recovery_settings`, `update_recovery_settings`, `get_save_offers_report`, `get_intro_pricing_report`, `list_retention_offers`, `get_retention_offer` and `update_retention_offer`. # Subscriptions API quickstart Source: https://docs.pocketsflow.com/api-reference/subscriptions-quickstart Sell and manage recurring subscriptions from your own code — checkout, subscriber roster, live status checks, lifecycle actions, and webhooks, with copy-paste examples in cURL, Node.js, Python, and PHP. This page is the end-to-end integration path for subscriptions: create a checkout for a subscription offer, list your subscribers, gate access on a subscriber's live status, cancel/pause/resume from your backend, and react to subscription webhooks. You can create offers through the REST API or in the dashboard — see the [subscriptions guide](/selling/subscriptions). For the full endpoint catalog, see the [API reference](/api-reference/introduction). **1. Sell** `POST /checkout/sessions` with your subscription offer's id, redirect the buyer to the returned `url`. **2. Gate** Check `GET /subscriptions/subscribers/{id}` (optionally `?live=true`) before serving paid content. **3. React** Verify and handle `customer.subscription.*` / `invoice.*` webhooks to keep your records in sync. ## 1. Authentication and base URL Every request goes to `https://api.pocketsflow.com` with your API key in the `Authorization` header — `pk_live_…` for live mode, `pk_test_…` for sandbox data. Create keys in the dashboard under **Developers → API keys**, and keep them server-side only. Details: [Authentication & security](/api-webhooks/authentication-and-security). ```bash cURL theme={"system"} curl https://api.pocketsflow.com/users/me \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` ```javascript Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/users/me", { headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}` }, }); const me = await res.json(); ``` ```python Python theme={"system"} import os import requests res = requests.get( "https://api.pocketsflow.com/users/me", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, ) me = res.json() ``` ```php PHP theme={"system"} $ch = curl_init('https://api.pocketsflow.com/users/me'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), ], ]); $me = json_decode(curl_exec($ch), true); curl_close($ch); ``` ## Create a subscription offer Use `POST /subscriptions` to create the recurring product before creating a checkout session. The endpoint accepts JSON for API clients and `multipart/form-data` when you also need to upload offer assets. ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/subscriptions \ -H "Authorization: Bearer pk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Pro Membership", "price": 29, "frequency": "monthly", "trialPeriod": 0, "redirectBackUrl": "https://yourapp.com/billing" }' ``` `price` is in USD. `frequency` must be `weekly`, `monthly`, or `yearly`; `trialPeriod` is the number of trial days. The endpoint returns the created offer with `201 Created`. The same operation is available through the official Node.js/TypeScript SDK: ```ts theme={"system"} import { Pocketsflow } from "pocketsflow"; const pocketsflow = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY!, }); const offer = await pocketsflow.subscriptionOffers.create({ name: "Pro Membership", price: 29, frequency: "monthly", trialPeriod: 0, redirectBackUrl: "https://yourapp.com/billing", }); ``` Install the SDK with `npm install pocketsflow`. See the [SDK guide](/api-reference/sdk) for configuration, resource methods, and error handling. The SDK source's current v1.2.0 release includes `subscriptionOffers.create`; if your installed npm version predates that release, use the REST request above until you upgrade. ## 2. Create a checkout session for a subscription offer `POST /checkout/sessions` accepts a **subscription offer id** in `productId` (the same field used for one-time products — pass either kind of id). Redirect the buyer to the `url` in the response; Pocketsflow hosts the checkout and the recurring billing. ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "665f1c2a9b3e4a0012ab7788", "successUrl": "https://yourapp.com/welcome", "cancelUrl": "https://yourapp.com/pricing", "customerEmail": "ada@example.com", "clientReferenceId": "user_8271", "metadata": { "plan": "pro" } }' ``` ```javascript Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ productId: "665f1c2a9b3e4a0012ab7788", // subscription offer _id successUrl: "https://yourapp.com/welcome", cancelUrl: "https://yourapp.com/pricing", customerEmail: user.email, clientReferenceId: user.id, // echoed back on every subscription webhook metadata: { plan: "pro" }, }), }); const { url } = await res.json(); // Redirect the buyer to `url`. ``` ```python Python theme={"system"} import os import requests res = requests.post( "https://api.pocketsflow.com/checkout/sessions", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, json={ "productId": "665f1c2a9b3e4a0012ab7788", # subscription offer _id "successUrl": "https://yourapp.com/welcome", "cancelUrl": "https://yourapp.com/pricing", "customerEmail": user.email, "clientReferenceId": user.id, # echoed back on every subscription webhook "metadata": {"plan": "pro"}, }, ) session = res.json() # Redirect the buyer to session["url"]. ``` ```php PHP theme={"system"} $ch = curl_init('https://api.pocketsflow.com/checkout/sessions'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'productId' => '665f1c2a9b3e4a0012ab7788', // subscription offer _id 'successUrl' => 'https://yourapp.com/welcome', 'cancelUrl' => 'https://yourapp.com/pricing', 'customerEmail' => $user_email, 'clientReferenceId' => $user_id, // echoed back on every subscription webhook 'metadata' => ['plan' => 'pro'], ]), ]); $session = json_decode(curl_exec($ch), true); curl_close($ch); // header('Location: ' . $session['url']); ``` The response is `201` with: ```json theme={"system"} { "id": "cs_3f2a9d0e1b2c4a5d6e7f8091a2b3c4d5e6f70819", "url": "https://yourstore.pocketsflow.com/checkout?…" } ``` `successUrl`/`cancelUrl` must be absolute `http(s)` URLs; `clientReferenceId` (max 256 chars) and `metadata` are captured at activation and replayed on every `customer.subscription.*` / `invoice.*` webhook, so you can bind events back to your own user records. The full field table is in the [custom platforms guide](/integrations/custom-platforms). ## 3. List your subscription offers `GET /subscriptions` returns your offers (the recurring products), newest first, scoped to your account and the key's test/live mode. Use it to find the `_id` to sell in step 2. ```bash cURL theme={"system"} curl https://api.pocketsflow.com/subscriptions \ -H "Authorization: Bearer pk_live_xxx" ``` ```javascript Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/subscriptions", { headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}` }, }); const offers = await res.json(); ``` ```python Python theme={"system"} import os import requests offers = requests.get( "https://api.pocketsflow.com/subscriptions", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, ).json() ``` ```php PHP theme={"system"} $ch = curl_init('https://api.pocketsflow.com/subscriptions'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), ], ]); $offers = json_decode(curl_exec($ch), true); curl_close($ch); ``` ```json theme={"system"} [ { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "subtitle": "Everything in Starter, plus…", "price": 29, "currency": "usd", "frequency": "monthly", "trialPeriod": 0, "published": true, "testMode": false, "createdAt": "2026-05-01T09:12:44.103Z", "…": "…" } ] ``` `frequency` is `weekly`, `monthly`, or `yearly`. A single offer is available at `GET /subscriptions/{id}` (`404` if it doesn't exist or isn't yours). ## 4. List subscribers (filter by status) `GET /subscriptions/subscribers` is the paginated roster of buyers across your offers. Filters: `status`, `buyerEmail` (alias `email`), `subscriptionId`, `page` (default `1`), `pageSize` (default `20`). ```bash cURL theme={"system"} curl "https://api.pocketsflow.com/subscriptions/subscribers?status=active&page=1&pageSize=20" \ -H "Authorization: Bearer pk_live_xxx" ``` ```javascript Node.js theme={"system"} const params = new URLSearchParams({ status: "active", page: "1", pageSize: "20" }); const res = await fetch( `https://api.pocketsflow.com/subscriptions/subscribers?${params}`, { headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}` } }, ); const { subscribers, pagination } = await res.json(); ``` ```python Python theme={"system"} import os import requests data = requests.get( "https://api.pocketsflow.com/subscriptions/subscribers", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, params={"status": "active", "page": 1, "pageSize": 20}, ).json() subscribers, pagination = data["subscribers"], data["pagination"] ``` ```php PHP theme={"system"} $query = http_build_query(['status' => 'active', 'page' => 1, 'pageSize' => 20]); $ch = curl_init('https://api.pocketsflow.com/subscriptions/subscribers?' . $query); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), ], ]); $data = json_decode(curl_exec($ch), true); curl_close($ch); $subscribers = $data['subscribers']; ``` ```json theme={"system"} { "subscribers": [ { "_id": "665f1c2a9b3e4a0012abccdd", "buyerEmail": "ada@example.com", "status": "active", "active": true, "partnerPlanId": "plan_vlD50mPbsqJLp", "subscriptionId": "665f1c2a9b3e4a0012ab7788", "firstName": "Ada", "lastName": "Lovelace", "country": "NL", "portalUrl": "https://app.pocketsflow.com/portal/665f1c2a9b3e4a0012ab7788/665f1c2a9b3e4a0012abccdd?token=9f2c…", "createdAt": "2026-06-24T10:00:00.000Z", "subscription": { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "price": 29, "frequency": "monthly" } } ], "pagination": { "totalCount": 137, "totalPages": 7, "currentPage": 1, "pageSize": 20, "hasMore": true } } ``` `status` values include `active`, `trialing`, `past_due`, `paused`, and `canceled` (full list in the [API reference](/api-reference/introduction#subscriptions-and-subscribers)). `portalUrl` is the subscriber's self-service portal — share it so buyers can manage their own membership. Send it **exactly as returned**: its `?token=…` is what lets the buyer cancel or resume. A link you build yourself from the two ids (without the token) opens the portal read-only. ## 5. Verify one subscriber's live status (the access gate) Before serving paid content, look the subscriber up by their `_id` (the 24-hex Mongo id from step 4 or from webhooks — **not** a `mem_…` id here). Add `?live=true` to also fetch the authoritative membership from the payment processor as `membership`; if that live lookup fails, `membership` is `null` and the stored `status` still applies, so the request never fails. ```bash cURL theme={"system"} curl "https://api.pocketsflow.com/subscriptions/subscribers/665f1c2a9b3e4a0012abccdd?live=true" \ -H "Authorization: Bearer pk_live_xxx" ``` ```javascript Node.js theme={"system"} const res = await fetch( `https://api.pocketsflow.com/subscriptions/subscribers/${subscriberId}?live=true`, { headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}` } }, ); const { status, membership } = await res.json(); // Gate: prefer the live membership when available, fall back to stored status. const isPaying = membership ? membership.valid === true : ["active", "trialing"].includes(status); ``` ```python Python theme={"system"} import os import requests data = requests.get( f"https://api.pocketsflow.com/subscriptions/subscribers/{subscriber_id}", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, params={"live": "true"}, ).json() # Gate: prefer the live membership when available, fall back to stored status. membership = data.get("membership") is_paying = ( membership["valid"] is True if membership else data["status"] in ("active", "trialing") ) ``` ```php PHP theme={"system"} $ch = curl_init( 'https://api.pocketsflow.com/subscriptions/subscribers/' . $subscriber_id . '?live=true' ); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), ], ]); $data = json_decode(curl_exec($ch), true); curl_close($ch); // Gate: prefer the live membership when available, fall back to stored status. $is_paying = isset($data['membership']) ? ($data['membership']['valid'] ?? false) === true : in_array($data['status'], ['active', 'trialing'], true); ``` ```json theme={"system"} { "subscriber": { "_id": "665f1c2a9b3e4a0012abccdd", "buyerEmail": "ada@example.com", "status": "active", "active": true, "portalUrl": "https://app.pocketsflow.com/portal/665f1c2a9b3e4a0012ab7788/665f1c2a9b3e4a0012abccdd?token=9f2c…", "…": "…" }, "subscription": { "_id": "665f1c2a9b3e4a0012ab7788", "name": "Pro Membership", "price": 29, "frequency": "monthly", "…": "…" }, "customer": { "_id": "665f1c2a9b3e4a0012abaa11", "buyerEmail": "ada@example.com", "…": "…" }, "status": "active", "payments": [ { "_id": "665f1c2a9b3e4a0012ab0002", "billingReason": "renewal", "amount": 29, "createdAt": "2026-06-24T10:00:00.000Z" }, { "_id": "665f1c2a9b3e4a0012ab0001", "billingReason": "initial", "amount": 29, "createdAt": "2026-05-24T10:00:00.000Z" } ], "membership": { "id": "mem_UCTD32gDLGTgb", "status": "active", "valid": true } } ``` `payments` is the full history for this membership — the `initial` charge plus every `renewal`. For hot paths, gate on the stored `status` (kept fresh by webhooks) and reserve `?live=true` for the moments that matter, like restoring account access after a failed payment. ## 6. Cancel, pause, or resume a subscriber Three lifecycle actions, all `POST` with an empty body. `{id}` is the subscriber's `_id` **or** their processor membership id (`mem_…`). | Action | Path | Effect | | - | - | - | | Cancel | `POST /subscriptions/{id}/cancel` | Cancels **at period end** — the buyer keeps access until the paid period runs out. | | Pause | `POST /subscriptions/{id}/pause` | Stops payment collection; the buyer **keeps access** until resumed. | | Resume | `POST /subscriptions/{id}/resume` | Reverses a scheduled cancel / restarts collection. | ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/subscriptions/665f1c2a9b3e4a0012abccdd/cancel \ -H "Authorization: Bearer pk_live_xxx" ``` ```javascript Node.js theme={"system"} const res = await fetch( `https://api.pocketsflow.com/subscriptions/${subscriberId}/cancel`, { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}` }, }, ); const { success, status, cancelAtPeriodEnd } = await res.json(); // Same call shape for `/pause` and `/resume`. ``` ```python Python theme={"system"} import os import requests result = requests.post( f"https://api.pocketsflow.com/subscriptions/{subscriber_id}/cancel", headers={"Authorization": f"Bearer {os.environ['POCKETSFLOW_API_KEY']}"}, ).json() # Same call shape for `/pause` and `/resume`. ``` ```php PHP theme={"system"} $ch = curl_init( 'https://api.pocketsflow.com/subscriptions/' . $subscriber_id . '/cancel' ); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('POCKETSFLOW_API_KEY'), ], ]); $result = json_decode(curl_exec($ch), true); curl_close($ch); // Same call shape for `/pause` and `/resume`. ``` `cancel` and `resume` respond with: ```json theme={"system"} { "success": true, "status": "active", "cancelAtPeriodEnd": true, "manageUrl": "https://…" } ``` `pause` adds a `paused` boolean to the same shape. Pause is provider-first: if the processor refuses, you get a `502` and **no local state changes** — and a subscriber with no membership on record returns `400`. Cancelling also fires the `customer.subscription.updated` webhook (and `customer.subscription.deleted` when the membership actually ends); pausing/resuming fire `customer.subscription.pause` / `customer.subscription.resumed`. ## 7. Receive and verify subscription webhooks Register an endpoint (dashboard, or `POST /webhooks`) and subscribe to the subscription events. Every delivery is a `POST` with these headers: | Header | Description | | - | - | | `X-Pocketsflow-Event` | The event name — route on this (same as the body's `type`). | | `X-Pocketsflow-Event-Id` | The event id, `evt_…` (same as the body's `id`). Retries reuse it — de-duplicate on it. | | `X-Pocketsflow-Signature-V2` | `t=,v1=` — binds the timestamp to the body; reject stale `t` values to stop replays. | | `X-Pocketsflow-Signature` | Legacy: hex HMAC-SHA256 of the **raw** request body, keyed with your endpoint's signing secret. | | `X-Pocketsflow-Timestamp` | Unix epoch milliseconds when the attempt was sent (informational — **not** signed). | Every body also carries top-level `id`, `type`, and `created` (Unix seconds), plus `test: true` on deliveries sent with `POST /webhooks/{id}/test`. Subscription-related events: `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.pause`, `customer.subscription.resumed`, `customer.subscription.trial_will_end`, `invoice.created`, `invoice.upcoming`, `invoice.payment_succeeded`, `invoice.payment_failed`, `payment_intent.succeeded`, and `payment_intent.payment_failed`. Every payload carries a top-level `subscriptionCustomerId` (the subscriber `_id` from steps 4–6) and your `clientReferenceId`/`metadata` from checkout. Payload shapes: [Webhook events](/api-webhooks/events). Always verify the signature over the **raw body** (never re-serialize the parsed JSON) with a constant-time comparison. The examples below check the legacy `X-Pocketsflow-Signature`; to use `X-Pocketsflow-Signature-V2`, compute the same HMAC over `` `${t}.${rawBody}` `` and compare it to the `v1` value — see [Authentication & security](/api-webhooks/authentication-and-security). ```javascript Node.js (Express) theme={"system"} import express from "express"; import crypto from "crypto"; const app = express(); app.post( "/webhooks/pocketsflow", express.raw({ type: "application/json" }), (req, res) => { const signature = req.header("X-Pocketsflow-Signature") || ""; const expected = crypto .createHmac("sha256", process.env.POCKETSFLOW_WEBHOOK_SECRET) .update(req.body) // raw Buffer .digest("hex"); const a = Buffer.from(signature); const b = Buffer.from(expected); if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) { return res.status(400).send("Invalid signature"); } const event = req.header("X-Pocketsflow-Event"); const payload = JSON.parse(req.body.toString("utf8")); switch (event) { case "customer.subscription.created": grantAccess(payload.subscriptionCustomerId, payload.clientReferenceId); break; case "customer.subscription.deleted": revokeAccess(payload.subscriptionCustomerId); break; case "invoice.payment_failed": flagPastDue(payload.subscriptionCustomerId); break; } // Handlers must be idempotent. res.status(200).send("OK"); } ); ``` ```python Python (Flask) theme={"system"} import hashlib import hmac import os from flask import Flask, abort, request app = Flask(__name__) @app.post("/webhooks/pocketsflow") def pocketsflow_webhook(): raw = request.get_data() # raw bytes — never re-serialize signature = request.headers.get("X-Pocketsflow-Signature", "") expected = hmac.new( os.environ["POCKETSFLOW_WEBHOOK_SECRET"].encode(), raw, hashlib.sha256 ).hexdigest() if not hmac.compare_digest(signature, expected): abort(400) event = request.headers.get("X-Pocketsflow-Event") payload = request.get_json() if event == "customer.subscription.created": grant_access(payload["subscriptionCustomerId"], payload.get("clientReferenceId")) elif event == "customer.subscription.deleted": revoke_access(payload["subscriptionCustomerId"]) elif event == "invoice.payment_failed": flag_past_due(payload["subscriptionCustomerId"]) # Handlers must be idempotent. return "OK", 200 ``` ```php PHP theme={"system"} $raw = file_get_contents( 'php://input' ); $signature = $_SERVER['HTTP_X_POCKETSFLOW_SIGNATURE'] ?? ''; $expected = hash_hmac( 'sha256', $raw, getenv( 'POCKETSFLOW_WEBHOOK_SECRET' ) ); if ( ! hash_equals( $expected, $signature ) ) { http_response_code( 400 ); exit( 'Invalid signature' ); } $event = $_SERVER['HTTP_X_POCKETSFLOW_EVENT'] ?? ''; $payload = json_decode( $raw, true ); switch ( $event ) { case 'customer.subscription.created': grant_access( $payload['subscriptionCustomerId'], $payload['clientReferenceId'] ?? null ); break; case 'customer.subscription.deleted': revoke_access( $payload['subscriptionCustomerId'] ); break; case 'invoice.payment_failed': flag_past_due( $payload['subscriptionCustomerId'] ); break; } // Handlers must be idempotent. http_response_code( 200 ); echo 'OK'; ``` > [!NOTE] > > Each attempt has a **15-second timeout** — acknowledge with a `2xx` > immediately and do the real work asynchronously. A delivery that gets a > `5xx` or a `429`, times out, or never reaches your endpoint, is retried (up > to 4 attempts, about 10 s, 1 min and 5 min apart) with the same event id. > Every attempt is in the > delivery log (`GET /delivered-webhooks`, kept 30 days) and can be replayed > with `POST /delivered-webhooks/{id}/redeliver`; you can also reconcile via > `GET /subscriptions/subscribers` (step 4). ## Example repository Prefer runnable code? The [subscriptions example on GitHub](https://github.com/pocketsflow/subscriptions-example) has everything on this page as a clone-and-run project: a checkout embed (hosted link, popup, and inline) plus a Node/Express webhook receiver that verifies the signature and handles the full subscription lifecycle. ## Related topics * [Subscriptions example repo](https://github.com/pocketsflow/subscriptions-example) — runnable embed + webhook code * [Webhook events](/api-webhooks/events) — every payload, field by field * [Authentication & security](/api-webhooks/authentication-and-security) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [API reference](/api-reference/introduction) * [Subscriptions guide](/selling/subscriptions) — creating offers in the dashboard * [Custom platforms](/integrations/custom-platforms) — the generic checkout + webhook pattern # Team Source: https://docs.pocketsflow.com/api-reference/team List team members, send and manage invites, edit teams and read the activity log with an API key. Growth plan and up. With an API key you act as the **store owner**. Accepting an invite and switching stores are a person's own actions and stay in the dashboard. See [Team members](/operations/team) for roles, areas and seats. | Method | Path | What it does | | - | - | - | | `GET` | `/team` | Members, pending invites, teams and seat usage | | `GET` | `/team/activity` | Activity log, newest first (`before`, `limit`) | | `POST` | `/team/invites` | Invite `{ email, role, teamIds? }` | | `POST` | `/team/invites/{id}/resend` | New link, 7 more days (once a minute, 5 times) | | `DELETE` | `/team/invites/{id}` | Cancel an invite | | `PATCH` | `/team/members/{id}` | Change `{ role?, teamIds?, status? }` | | `DELETE` | `/team/members/{id}` | Remove someone | | `POST` | `/team/teams` | Create a team `{ name, areas }` | | `PATCH` | `/team/teams/{id}` | Rename or re-scope a team | | `DELETE` | `/team/teams/{id}` | Delete a team | Roles: `owner`, `admin`, `member`. Areas: `products`, `orders`, `emails`, `marketing`, `analytics`, `developers`. ## Invite someone ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/team/invites \ -H "Authorization: Bearer pk_live_…" \ -H "Content-Type: application/json" \ -d '{ "email": "sara@example.com", "role": "member", "teamIds": ["6710b2c49e3f1a0012cd56ef"] }' ``` ```json theme={"system"} { "invite": { "id": "6710b2c49e3f1a0012cd5699", "email": "sara@example.com", "role": "member", "teamIds": ["6710b2c49e3f1a0012cd56ef"], "expiresAt": "2026-10-23T12:00:00.000Z" }, "emailSent": true } ``` ## Errors | Status | `code` | Meaning | | - | - | - | | `403` | `FEATURE_LOCKED` | Your plan doesn't include team members (Growth and up) | | `403` | `SEAT_LIMIT` | Every seat is taken (`details.limit`, `details.used`, `details.pending`) | | `403` | `ROLE_FORBIDDEN` | Only owners give or change the owner role | | `409` | `ALREADY_INVITED` / `ALREADY_MEMBER` | That email already has an invite or a seat | | `409` | `LAST_OWNER` | The store would have no owner left | | `429` | `INVITE_RATE_LIMITED` | More than 20 invites in an hour | ## MCP tools The [MCP server](/api-reference/mcp-server) exposes the same operations: `list_team_members`, `list_team_activity`, `invite_team_member`, `resend_team_invite`, `cancel_team_invite`, `update_team_member`, `remove_team_member`, `create_team`, `update_team`, `delete_team`. # Testimonials Source: https://docs.pocketsflow.com/api-reference/testimonials Moderate buyer testimonials, change the request settings and render a product wall with your API key or from an AI agent over MCP. A testimonial is a review with extras: the buyer's stars and words, their consent, the name they chose and an optional short video. Buyers send them from the page linked in the request email. Product guide: [Testimonials](/selling/testimonials). > [!NOTE] > > Growth plan and above. Approving or featuring a testimonial, and saving the > settings with any switch on, answer `403` with `code: FEATURE_LOCKED` on a > plan without testimonials. Reading, hiding and switching off stay open. ## Endpoints | Method | Endpoint | Operation ID | MCP tool | | - | - | - | - | | `GET` | `/testimonials` | `listTestimonials` | `list_testimonials` | | `GET` | `/testimonials/{id}` | `getTestimonial` | `get_testimonial` | | `PATCH` | `/testimonials/{id}` | `moderateTestimonial` | `moderate_testimonial` | | `GET` | `/testimonials/settings` | `getTestimonialSettings` | `get_testimonial_settings` | | `PUT` | `/testimonials/settings` | `updateTestimonialSettings` | `update_testimonial_settings` | | `GET` | `/testimonials/public/products/{productId}` | `getTestimonialWall` (public) | — | ## Moderate ```bash theme={"system"} # What's waiting curl https://api.pocketsflow.com/testimonials?status=pending \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" # Feature one (featuring also approves it) curl -X PATCH https://api.pocketsflow.com/testimonials/6712b0c49e3f1a0012cd9911 \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "featured": true }' ``` `status` is `pending`, `approved` or `hidden`. `featured: true` approves; hiding or moving back to pending un-features. The list also returns `counts` for every tab (`pending`, `approved`, `featured`, `hidden`, `all`). ## Settings ```json theme={"system"} { "requestEnabled": true, "delayDays": 7, "askVideo": true, "wallEnabled": true, "checkoutStrip": true } ``` `delayDays` is 1 to 60. Fields left out keep their value. ## Render a wall on your own site `GET /testimonials/public/products/{productId}` needs no key. It returns up to 24 approved testimonials of live orders, featured first, with the name to show and the video URL. It never includes an email or an order id, and answers `enabled: false` when the store has the wall and the strip off or its plan no longer includes testimonials. ## Webhook: `testimonial.submitted` Sent when a buyer sends a testimonial from the request page. It waits for your moderation. A new review also fires `review.created`. ```json theme={"system"} { "id": "evt_6a43ce05fae6c4f0cb5a2193", "type": "testimonial.submitted", "created": 1767225600, "testimonial": { "id": "6712b0c49e3f1a0012cd9911", "productId": "665f1c2a9b3e4a0012ab34cd", "productName": "Notion Creator Kit", "saleId": "6711a3d59e3f1a0012cd7799", "buyerEmail": "jordan@example.com", "displayName": "Jordan S.", "rating": 5, "text": "Saved me hours every week.", "video": { "url": "https://d372ebr33sbljd.cloudfront.net/testimonials/…/9f2c1e.webm", "contentType": "video/webm", "durationSeconds": 41.2 }, "status": "pending", "submittedAt": "2026-10-12T09:30:00.000Z" } } ``` # Tracked links API Source: https://docs.pocketsflow.com/api-reference/tracked-links Create short links for your posts and ads, and read the visits, sales and revenue each one brought in. Tracked links are short links to pages of your store (`https:///go/`). Each click is counted, then the buyer is sent to the destination with UTM parameters and a `pf_link` parameter. The store keeps `pf_link` for 30 days and a purchase in that window is credited to the **last** link the buyer clicked. How it works for creators: [Tracked links](/operations/tracked-links). Base URL `https://api.pocketsflow.com`, API key in the `Authorization` header, like every other endpoint. > [!NOTE] > > Needs the **Starter** plan or above. Below it, `POST` and editing `PATCH` > calls answer `403` with `code: "FEATURE_LOCKED"`; reads still list your > links (they keep redirecting) but `stats`, `totals`, `channels` and `daily` > are `null` and `statsLocked` is `true`. Archiving (`PATCH` with only > `archived`) always works. ## Create a link ```bash theme={"system"} curl -X POST https://api.pocketsflow.com/tracked-links \ -H "Authorization: Bearer pk_live_..." \ -H "Content-Type: application/json" \ -d '{ "destination": "/notion-creator-kit", "slug": "ig-bio", "label": "Instagram bio", "channel": "instagram" }' ``` ```json theme={"system"} { "link": { "_id": "6711a3d59e3f1a0012cd7788", "slug": "ig-bio", "label": "Instagram bio", "channel": "instagram", "destination": "https://redmug.pocketsflow.com/notion-creator-kit", "utm": { "source": "instagram", "medium": "social", "campaign": "ig-bio" }, "archived": false, "shortUrl": "https://redmug.pocketsflow.com/go/ig-bio", "createdAt": "2026-10-16T09:12:44.000Z", "updatedAt": "2026-10-16T09:12:44.000Z" } } ``` | Field | Required | Notes | | - | - | - | | `destination` | yes | A page of your store: your subdomain, a domain you connected, or `https://app.pocketsflow.com/checkout?productId=…` for one of your products. A bare path (`/ebook`) is on your subdomain. Anything else is refused with `400`. | | `slug` | no | Letters, numbers and hyphens, up to 48, lowercased. Unique per store; `409` with a free `suggestion` when taken. Omit to derive one. Never changes after creation. | | `label` | no | Up to 80 characters. | | `channel` | no | `instagram`, `tiktok`, `youtube`, `x`, `facebook`, `email`, `ads` or `other` (default). | | `utm` | no | `{ source, medium, campaign }`. Blanks are filled from the channel and the slug. | Check a slug first with `GET /tracked-links/slug-available?slug=ig-bio`: `{ "slug": "ig-bio", "valid": true, "available": false, "suggestion": "ig-bio-k3x" }`. ## Read the stats `GET /tracked-links` returns every link with its stats over the range, plus `totals`, a `channels` breakdown and a `daily` series. `GET /tracked-links/{id}` returns one link with its `daily` series and the top 20 `countries` of its visitors. | Query | Notes | | - | - | | `startDate`, `endDate` | ISO dates. Default: since the first link was created (list) or since the link was created (one link), until now. Capped at 366 days. | | `timezoneOffsetMinutes` | Your `Date#getTimezoneOffset()` so daily rows follow your local days. | | `archived=1` | List only: include archived links. | ```json theme={"system"} { "stats": { "clicks": 412, "visitors": 361, "sales": 18, "revenue": 846, "conversionRate": 4.99 } } ``` * `clicks` leave out bots, link previews, prefetches and repeat clicks by the same visitor within 30 minutes. * `sales` and `revenue` (account currency) leave out refunded and test-mode orders; free claims count as sales. ## Edit or archive `PATCH /tracked-links/{id}` with any of `label`, `destination`, `channel`, `utm` (needs the plan) or `archived` (always allowed). Sending a different `slug` answers `400`: posted links never break. ## MCP The same operations are MCP tools: `list_tracked_links`, `create_tracked_link`, `get_tracked_link_stats` and `update_tracked_link`. See [MCP server](/api-reference/mcp-server). # Usage billing API Source: https://docs.pocketsflow.com/api-reference/usage-billing Set seats and meters on a subscription offer, report usage for each subscriber, change seats and read usage — with curl and SDK examples. The usage billing endpoints let your software charge subscribers **per seat** and **per unit of usage**. How it works for you and your buyers is in [Usage-based and per-seat pricing](/selling/usage-based-pricing). * Base URL `https://api.pocketsflow.com`, `Authorization: Bearer pk_live_…` (or `pk_test_…` for test mode). * Requires the **Pro** plan: below it, writes answer `403 FEATURE_LOCKED` (`details.requiredPlan: "tier3"`). Reading usage stays available after a downgrade. * Money is **integer cents** in your account currency. * `{id}` on the subscriber endpoints is the subscriber `_id` from `GET /subscriptions/subscribers` or its membership id (`mem_…`). On `/usage-pricing` it is the subscription **offer** id. > [!NOTE] > > The SDK methods below ship in the next `pocketsflow` release. Until then, > call the endpoints directly (curl examples) or use the MCP tools. ## Set seats and meters on an offer `PUT /subscriptions/{id}/usage-pricing` replaces the offer's usage pricing. Sending `{ "seats": { "enabled": false }, "meters": [] }` switches back to flat pricing (always allowed). The same `usagePricing` object is also accepted by `POST /subscriptions` when you create an offer. ```bash curl theme={"system"} curl -X PUT https://api.pocketsflow.com/subscriptions/665f1c2a9b3e4a0012ab34cd/usage-pricing \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "seats": { "enabled": true, "minSeats": 1, "maxSeats": 50, "licenseKeys": true }, "meters": [ { "key": "api_calls", "name": "API calls", "unit": "call", "pricing": "graduated", "packageSize": 1000, "includedUnits": 10000, "tiers": [ { "upTo": 100000, "unitAmountCents": 100 }, { "upTo": null, "unitAmountCents": 50 } ] } ] }' ``` ```ts SDK theme={"system"} await pocketsflow.subscriptions.updateUsagePricing("665f1c2a9b3e4a0012ab34cd", { seats: { enabled: true, minSeats: 1, maxSeats: 50, licenseKeys: true }, meters: [ { key: "api_calls", name: "API calls", unit: "call", pricing: "graduated", packageSize: 1000, includedUnits: 10000, tiers: [ { upTo: 100000, unitAmountCents: 100 }, { upTo: null, unitAmountCents: 50 }, ], }, ], }); ``` | Field | Notes | | - | - | | `seats.enabled` | Price per seat: buyers pick seats at checkout. | | `seats.minSeats` / `seats.maxSeats` | 1–10,000; `maxSeats: null` = no maximum. | | `seats.licenseKeys` | Issue each subscriber a license key whose activation limit follows their seats. | | `meters[].key` | `^[a-z0-9][a-z0-9_.-]{0,39}$`, unique per offer. What you send as `meter`. | | `meters[].pricing` | `per_unit`, `graduated` or `volume`. | | `meters[].unitAmountCents` | `per_unit`: cents per `packageSize` units. | | `meters[].packageSize` | Units one price applies to (default 1). | | `meters[].includedUnits` | Free units per period (default 0). | | `meters[].tiers` | `graduated` / `volume`: up to 10, ascending `upTo` (billable units), last `upTo: null`. Optional `flatAmountCents`. | At most 5 meters per offer. ## Report usage `POST /subscriptions/{id}/usage` | Field | Required | Notes | | - | - | - | | `meter` | yes | A meter `key` of the subscriber's offer (else `422 UNKNOWN_METER`). | | `quantity` | yes | Whole number, 0–1,000,000,000. | | `timestamp` | no | ISO 8601 or Unix seconds. Defaults to now. Not in the future, not before the subscription started, and in a period that is still open (else `409 PERIOD_CLOSED`). | | `idempotencyKey` | strongly recommended | Up to 255 characters, or send an `Idempotency-Key` header. | **Idempotency.** The first report with a key answers `201` with `replayed: false`. Retrying the same key with the same body answers `200` with the original record and `replayed: true` — it is counted once, even when retries race. The same key with a different body is refused with `409 IDEMPOTENCY_KEY_REUSED`. Without a key every request counts. **Rate limit.** 300 reports per minute per subscriber (inside the account's 600 requests per minute). Aggregate before reporting — one report with `quantity: 500` costs the same as 500 reports with `quantity: 1`. ```bash curl theme={"system"} curl -X POST https://api.pocketsflow.com/subscriptions/665f1c2a9b3e4a0012ab9911/usage \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: req_8f2a91" \ -d '{ "meter": "api_calls", "quantity": 250 }' ``` ```ts SDK theme={"system"} const { usageRecord, replayed } = await pocketsflow.usage.report( "665f1c2a9b3e4a0012ab9911", { meter: "api_calls", quantity: 250, idempotencyKey: "req_8f2a91" }, ); ``` ```json Response 201 theme={"system"} { "usageRecord": { "id": "6710c5e09b3e4a0012ab77aa", "meter": "api_calls", "quantity": 250, "timestamp": "2026-10-16T09:12:44.000Z", "idempotencyKey": "req_8f2a91", "periodId": "6710b2c49e3f1a0012cd56ef", "source": "api", "createdAt": "2026-10-16T09:12:44.120Z" }, "period": { "id": "6710b2c49e3f1a0012cd56ef", "start": "2026-09-28T09:00:00.000Z", "end": "2026-10-28T09:00:00.000Z" }, "replayed": false } ``` ## Read usage `GET /subscriptions/{id}/usage?limit=20` returns the current period's running totals and upcoming overage, a per-day series, the latest reports (`limit`, max 100) and the last 12 closed periods with their charge status. ```bash curl theme={"system"} curl https://api.pocketsflow.com/subscriptions/665f1c2a9b3e4a0012ab9911/usage \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" ``` ```ts SDK theme={"system"} const usage = await pocketsflow.usage.get("665f1c2a9b3e4a0012ab9911", { limit: 20 }); console.log(usage.currentPeriod.upcomingOverageCents); ``` ```json Response (trimmed) theme={"system"} { "subscriber": { "id": "665f1c2a9b3e4a0012ab9911", "status": "active", "quantity": 5, "purchasedQuantity": 3 }, "currency": "usd", "currentPeriod": { "id": "6710b2c49e3f1a0012cd56ef", "start": "2026-09-28T09:00:00.000Z", "end": "2026-10-28T09:00:00.000Z", "status": "open", "lines": [ { "kind": "meter", "meter": "api_calls", "name": "API calls", "totalUnits": 81100, "includedUnits": 10000, "billableUnits": 71100, "amountCents": 7110 }, { "kind": "seats", "name": "Extra seats", "totalUnits": 1.6, "includedUnits": 3, "billableUnits": 1.6, "amountCents": 1920 } ], "upcomingOverageCents": 9030 }, "daily": [{ "date": "2026-10-16", "meter": "api_calls", "units": 4200 }], "periods": [{ "id": "…", "overageCents": 6420, "charge": { "status": "paid" } }], "outstandingCents": 0, "entitled": true } ``` `periods[].charge.status` is `not_due`, `processing`, `paid`, `failed`, `due` or `uncollectible`. Failed and due charges are retried 1, 3, 5 and 7 days after the first failure (`retries`, `nextRetryAt`); a paid overage is an order (`saleId`, `billingReason: "usage"` on `GET /orders` and the subscriber's payments). The seats line counts **seat-periods** above the seats bought at checkout: two extra seats held for 80% of the period are `1.6`. ## Change seats `POST /subscriptions/{id}/seats` with `{ "quantity": 5 }`. Takes effect at once; seats above the quantity bought at checkout are billed at the end of the period, prorated. Below the bought quantity answers `409 BELOW_PURCHASED_SEATS`; an inactive subscription `409 SUBSCRIPTION_INACTIVE`; outside the offer's min / max `400`. ```bash curl theme={"system"} curl -X POST https://api.pocketsflow.com/subscriptions/665f1c2a9b3e4a0012ab9911/seats \ -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "quantity": 5 }' ``` ```ts SDK theme={"system"} await pocketsflow.subscriptions.updateSeats("665f1c2a9b3e4a0012ab9911", { quantity: 5 }); ``` ## Errors | Status | `code` | When | | - | - | - | | 400 | `INVALID_METER`, `INVALID_QUANTITY`, `INVALID_TIMESTAMP`, `INVALID_IDEMPOTENCY_KEY`, `INVALID_USAGE_PRICING`, `SEATS_NOT_ENABLED` | The body is invalid; `message` says which field. | | 403 | `FEATURE_LOCKED` | Your plan does not include usage-based pricing. | | 404 | — | No such subscriber / offer in this key's mode. | | 409 | `IDEMPOTENCY_KEY_REUSED`, `PERIOD_CLOSED`, `BELOW_PURCHASED_SEATS`, `SUBSCRIPTION_INACTIVE` | See above. | | 422 | `UNKNOWN_METER` | The offer has no meter with that key. | | 429 | `RATE_LIMITED` | More than 300 reports a minute for one subscriber. | ## MCP tools The [MCP server](/api-reference/mcp-server) exposes the same operations: `update_usage_pricing`, `report_usage`, `get_subscription_usage` and `update_subscription_seats`. ## Webhooks `usage.recorded` (each new report) and `usage.period_closed` (totals and the overage charge) — payloads in [Webhook events](/api-webhooks/events#usage-billing-events). # Authentication & security Source: https://docs.pocketsflow.com/api-webhooks/authentication-and-security Verify that Pocketsflow webhook requests are genuine and keep your endpoint secure. Webhooks let Pocketsflow talk directly to your systems, so every request must be authenticated before you act on it. Pocketsflow signs each delivery with an HMAC-SHA256 signature you can verify with a shared secret, and stamps it with a unique event id you can use to drop duplicates and replays. ## Signing secret Each webhook endpoint has its own signing secret (a 48-character hex string). You receive it **once**, in the response to [`POST /webhooks`](/api-reference/introduction#webhooks): ```json theme={"system"} { "id": "6a43ca9f7e229e3568f9c9bb", "url": "https://acme.com/webhooks/pocketsflow", "events": ["order.completed", "invoice.payment_succeeded"], "description": "Production endpoint", "secret": "431b749a23715a17f15a0ecd60c0978403f7b3c7c85a8b94" } ``` > [!WARNING] > > The `secret` is returned when the endpoint is created, by > `GET /webhooks/{id}`, and by `POST /webhooks/{id}/rotate-secret`. > `GET /webhooks` (the list) never returns secrets. Store it immediately in a > secret manager or environment variable. ### Rotating the secret `POST /webhooks/{id}/rotate-secret` replaces the endpoint's signing secret and returns the new one **once**: ```json theme={"system"} { "id": "6a43ca9f7e229e3568f9c9bb", "secret": "9f2c4e1ab07d5c3e8f6a1b2d4c6e8f0a1b3c5d7e9f1a2b3c" } ``` The old secret stops working immediately — deliveries from that moment on are signed with the new one. Deploy the new secret to your endpoint right after rotating (or briefly accept both while you roll it out). ## How Pocketsflow signs a request For each delivery, Pocketsflow: 1. Builds the JSON body **once**: the envelope fields `id`, `type` and `created`, then your event data, then `webhookId`. 2. Signs the exact bytes of that body — two ways, described below. 3. Sends those same bytes as the request body. | Header | Value | | - | - | | `X-Pocketsflow-Signature-V2` | `t=,v1=.")>` — **recommended**. | | `X-Pocketsflow-Signature` | Hex HMAC-SHA256 of the raw request body (legacy, still sent on every delivery). | | `X-Pocketsflow-Event` | The event type (for example `order.completed`). Same as the body's `type`. | | `X-Pocketsflow-Event-Id` | Unique event id (`evt_…`). Same as the body's `id`. | | `X-Pocketsflow-Timestamp` | Unix epoch **milliseconds** the attempt was sent (informational, not signed). | The envelope fields in the body: | Field | Description | | - | - | | `id` | Unique event id (`evt_` + 24 hex characters). Identical on every retry and redelivery of the same event — use it to deduplicate. | | `type` | The event type, for example `order.completed`. | | `created` | Unix timestamp (seconds) when the event was created. | | `test` | `true` on deliveries sent by `POST /webhooks/{id}/test`. Absent otherwise. | | `webhookId` | The endpoint the event was delivered to. | ## Verifying the signature (V2, recommended) `X-Pocketsflow-Signature-V2` binds a timestamp to the body, so a captured request can't be replayed later with a fresh timestamp. **1. Read the raw body** Capture the request body as raw bytes **before** any JSON parsing or middleware re-serializes it. In Express, use `express.raw({ type: "application/json" })` for the webhook route. **2. Parse the header** Split `X-Pocketsflow-Signature-V2` on `,` into `t=` and `v1=`. **3. Check the timestamp** Reject the request if `t` is more than **5 minutes** away from your current time. **4. Recompute the HMAC** Compute `HMAC-SHA256(secret, t + "." + rawBody)` and hex-encode it. **5. Compare in constant time** Compare your digest to `v1` with a timing-safe comparison (`crypto.timingSafeEqual`, `hmac.compare_digest`, `hash_equals`). Reject with `400` if they differ. **6. Deduplicate, then process** Skip the event if you've already handled its `X-Pocketsflow-Event-Id` (also in the body as `id`). Otherwise record the id, parse the JSON, route on `type`, and process. ```javascript Node.js theme={"system"} import crypto from "crypto"; const TOLERANCE_SECONDS = 5 * 60; function verifyWebhookV2(rawBody, signatureHeader, secret) { const parts = Object.fromEntries( (signatureHeader || "").split(",").map((part) => part.split("=", 2)), ); const timestamp = Number(parts.t); if (!Number.isInteger(timestamp) || !parts.v1) return false; const age = Math.abs(Math.floor(Date.now() / 1000) - timestamp); if (age > TOLERANCE_SECONDS) return false; // too old (or clock skew) — reject const expected = crypto .createHmac("sha256", secret) .update(`${timestamp}.`) .update(rawBody) // exact bytes, not the re-serialized object .digest("hex"); const a = Buffer.from(parts.v1, "utf8"); const b = Buffer.from(expected, "utf8"); return a.length === b.length && crypto.timingSafeEqual(a, b); } ``` ```python Python theme={"system"} import hmac, hashlib, time TOLERANCE_SECONDS = 5 * 60 def verify_webhook_v2(raw_body: bytes, signature_header: str, secret: str) -> bool: parts = dict(p.split("=", 1) for p in signature_header.split(",") if "=" in p) try: timestamp = int(parts["t"]) except (KeyError, ValueError): return False if abs(int(time.time()) - timestamp) > TOLERANCE_SECONDS: return False expected = hmac.new( secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256 ).hexdigest() return hmac.compare_digest(parts.get("v1", ""), expected) ``` > [!WARNING] > > The signed body includes `webhookId` and the envelope fields, so verifying > against a re-serialized copy of the parsed JSON can change key order or > whitespace and break the signature. Always hash the raw request bytes exactly > as received. ## Deduplicating events Pocketsflow retries failed deliveries (see [Consuming webhooks](/api-webhooks/consuming-webhooks#delivery-guarantees)) and you can redeliver an event from the delivery log, so the same event can reach you more than once. Every copy carries the **same** event id in `X-Pocketsflow-Event-Id` and the body's `id`. Store the ids you've processed (keeping them for at least a few days is plenty) and skip any id you've already seen. Combined with the 5-minute timestamp tolerance, this also blocks replayed requests. ## Legacy signature (V1) `X-Pocketsflow-Signature` is still sent on every delivery so existing integrations keep working. It is the hex `HMAC-SHA256(secret, rawBody)` of the raw body only: ```javascript Node.js theme={"system"} import crypto from "crypto"; function verifyWebhook(rawBody, signatureHeader, secret) { const expected = crypto .createHmac("sha256", secret) .update(rawBody) // exact bytes, not the re-serialized object .digest("hex"); const a = Buffer.from(signatureHeader || "", "utf8"); const b = Buffer.from(expected, "utf8"); return a.length === b.length && crypto.timingSafeEqual(a, b); } ``` > [!NOTE] > > V1 does not cover the timestamp, so on its own it can't stop a captured > request from being replayed. If you stay on V1, deduplicate on the event id > and treat `X-Pocketsflow-Timestamp` as a secondary freshness check only. > New integrations should verify V2. ## Additional defenses * Serve your endpoint over **HTTPS** with a valid certificate (Pocketsflow only delivers to `https://` URLs on public addresses; it follows up to 3 `307`/`308` redirects, re-checking each hop the same way, and any other `3xx` counts as a failed delivery). * Validate `Content-Type: application/json` and the payload shape before acting. * Respond fast — deliveries time out after **15 seconds**. Acknowledge with a `2xx` and offload work to a queue. * Restrict inbound access with a firewall/WAF if feasible, and never expose sensitive internal services directly. ## Handling secrets safely * Store secrets in environment variables or a secret manager — never in source control or client-side code. * Use a distinct endpoint (and therefore secret) per environment; keep test-mode and live-mode endpoints separate. * Rotate a secret with `POST /webhooks/{id}/rotate-secret` if you suspect exposure or change infrastructure ownership. ## Related topics * [Webhook events](/api-webhooks/events) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Webhook examples](/api-webhooks/examples) * [Webhooks & API overview](/api-webhooks/overview) # Consuming webhooks Source: https://docs.pocketsflow.com/api-webhooks/consuming-webhooks Receive, verify, and process Pocketsflow webhooks reliably — idempotency, reconciliation, and delivery guarantees. Consuming webhooks correctly keeps your systems in sync with Pocketsflow without losing events or doing work twice. These patterns apply regardless of your stack. ## Core responsibilities Your endpoint should: 1. **Receive** the HTTP `POST` from Pocketsflow. 2. **Verify** the `X-Pocketsflow-Signature-V2` against the raw body, within a 5-minute tolerance (see [Authentication & security](/api-webhooks/authentication-and-security)). 3. **Deduplicate** on the event id (`X-Pocketsflow-Event-Id`, also the body's `id`). 4. **Acknowledge** with a `2xx` immediately. 5. **Parse** the JSON and route on the `X-Pocketsflow-Event` header (or the body's `type`). 6. **Process** the event idempotently in the background. ## Delivery guarantees > [!NOTE] > > Each attempt has a **15-second timeout**. If your endpoint answers `5xx` or > `429`, times out, resets the connection, or can't be reached at all > (connection refused, DNS failure), Pocketsflow retries up to **4 attempts in > total**, about 10 seconds, 1 minute and then 5 minutes apart. A timed-out > attempt may already have been processed, so deduplicate on the event id. > `307`/`308` redirects are followed (up to > 3 hops, each re-checked); other answers — `2xx` (success), other `3xx`, or > any other `4xx` — are final. Every attempt is recorded in the delivery log > (`GET /delivered-webhooks`), and you can re-send any logged delivery with > `POST /delivered-webhooks/{id}/redeliver`. Retries are best-effort, not a > durable queue: design for an event occasionally arriving more than once — > or not at all. Because of this, two habits matter most: * **Acknowledge fast.** Verify the signature, enqueue the event, and return `200` — all well under 15 seconds. Never do slow work (emails, third-party calls, heavy DB writes) before responding. * **Reconcile.** Periodically pull the source of truth from the API so a missed delivery self-heals: * Orders → [`GET /orders`](/api-reference/introduction#orders) * Payments (one-time + subscription) → [`GET /payments`](/api-reference/introduction#payments) * Subscribers → [`GET /subscriptions/subscribers`](/api-reference/introduction#subscriptions-and-subscribers) ## Idempotency Handlers must be safe to run more than once for the same logical event. The first line of defense is the **event id**: a retry or a redelivery of an event carries the same `X-Pocketsflow-Event-Id` (and body `id`) as the original, so record each id you process and skip ones you've seen. The event id is per *delivery of an event*, though — reconciliation via the API or two separate events about the same object won't share it. For business-level idempotency, also key on a stable value from the payload: | Event(s) | Suggested idempotency key | | - | - | | `order.completed`, `order.refunded` | `order.id` (and `order.paymentIntentId`) | | `payment_intent.succeeded`, `invoice.payment_succeeded`, `invoice.payment_failed` | `paymentId` (`pay_…`) | | `customer.subscription.created`, `customer.subscription.deleted` | `subscription.customerId` (each fires once per subscription) | | `customer.created` | `customer.id` | Before processing, check whether you've already handled that key; if so, skip. If not, record it and proceed. This protects you from re-processing during reconciliation and from any duplicate delivery. > [!WARNING] > > **Do not dedupe `customer.subscription.updated` on the customer id.** It is a > *state-change* signal and fires repeatedly over a subscription's life — past > due, recovery, cancel-scheduled, pause, resume, cancellation. Keying it on > `subscription.customerId` alone would make you drop every change after the > first. Treat it as a state sync instead: **upsert** from the payload's > `subscriptionCustomer.status` / `cancelAtPeriodEnd` / `paused` fields, which > are safe to apply more than once. The same applies to `invoice.upcoming` — key > it on the billing period (`renewalAt`), not the customer. ## Ordering Events are not guaranteed to arrive in the order they occurred. Don't assume, for example, that `payment_intent.succeeded` always lands before the first `invoice.payment_succeeded`. Make each handler tolerant of out-of-order arrival (upsert state; use the payload's own fields and the API rather than relying on sequence). ## Delivery log and redelivery Every attempt is logged with its HTTP `status`, `durationMs`, a short `error` (for example `Timed out`, `Connection refused`, `HTTP 503`, `Blocked destination`), the `attempt` number, the `eventId`, and the exact body that was sent. Logs are kept for 30 days. * `GET /delivered-webhooks?page=1&pageSize=50&webhookId=…&event=order.completed` lists attempts, newest first (`pageSize` max 100), with a `pagination` block. * `GET /delivered-webhooks/{id}` returns one attempt. * `POST /delivered-webhooks/{id}/redeliver` re-sends that attempt's body to its endpoint with fresh signature headers (same event id) and logs the result as a new attempt. All three accept an API key or a dashboard session. ## Error handling Plan for invalid payloads, downstream outages, and transient connectivity issues: * Log every delivery with enough context to debug (event type, event id, idempotency key, timestamp, and `webhookId`). * Return `2xx` only after you've safely **recorded** the event for processing — not after the full downstream work completes. * Alert when your handler's error rate crosses a threshold. ## Recommended flow **1. Read the raw body** Capture raw bytes before parsing so signature verification is exact. **2. Verify the signature** Check the V2 timestamp is within 5 minutes, recompute the HMAC-SHA256 and compare in constant time. Reject on mismatch. **3. Enqueue and acknowledge** Persist the raw event keyed by its event id (ignore an id you already have) and return `200`. **4. Process asynchronously** A worker routes on `event.type`, skips already-processed keys, performs the action, and marks the key done. For concrete language examples, see [Webhook examples](/api-webhooks/examples). ## Related topics * [Authentication & security](/api-webhooks/authentication-and-security) * [Webhook events](/api-webhooks/events) * [Webhook examples](/api-webhooks/examples) * [API reference](/api-reference/introduction) # Webhook events Source: https://docs.pocketsflow.com/api-webhooks/events Every event Pocketsflow can deliver to your webhook endpoints — when each fires, its payload, and how to verify the signature. Webhooks notify your systems in real time when something happens in your account — a sale completes, a subscription renews, a payment fails, a refund is issued, and more. When you register an endpoint you choose exactly which of the events below to receive. ## Delivery format Every delivery is an HTTP `POST` with a JSON body and these headers: | Header | Description | | - | - | | `X-Pocketsflow-Event` | The event type (for example `order.completed`). Route on this. | | `X-Pocketsflow-Event-Id` | Unique event id (`evt_…`), the same on every retry and redelivery. Deduplicate on this. | | `X-Pocketsflow-Signature-V2` | `t=,v1=.")>` — recommended. | | `X-Pocketsflow-Signature` | Hex HMAC-SHA256 of the raw request body, keyed with your endpoint's signing secret (legacy). | | `X-Pocketsflow-Timestamp` | Unix epoch milliseconds when the attempt was sent (informational — **not** part of either signature). | | `Content-Type` | Always `application/json`. | Every payload starts with three envelope fields — `id` (the event id), `type` (the event type) and `created` (unix seconds) — followed by the event fields shown below, and ends with a `webhookId` field identifying the endpoint the event was delivered to. Test deliveries (`POST /webhooks/{id}/test`) also carry `"test": true`. The examples below show the event fields; the envelope is omitted for brevity. A trimmed `order.completed` body looks like: ```json theme={"system"} { "id": "evt_5f1c2a9b3e4a0012abcd0d0e", "type": "order.completed", "created": 1767225600, "product": { "id": "6949918ee8d99b0e628103e0", "variantId": null }, "order": { "id": "6a43ce05fae6c4f0cb5a2193" }, "amount": 1000, "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` Because the signature is computed over the exact bytes, always verify against the **raw** request body before parsing — see [Verifying the signature](#verifying-the-signature) below and [Authentication & security](/api-webhooks/authentication-and-security). > [!NOTE] > > Each attempt has a **15-second timeout**. `5xx`, `429`, timeouts, resets and > connections that never reached your endpoint are retried up to 4 attempts in > total (about 10s, 1 min, then 5 min apart), always with the same event id. > Acknowledge with a `2xx` immediately, do the real work asynchronously, and > reconcile periodically via the API (for example > [`GET /payments`](/api-reference/introduction#payments)) in case a delivery is > missed. Every attempt — success or failure — is recorded in your account's > webhook delivery log. ## Test vs live deliveries A webhook endpoint is created in whichever mode your account is currently in. A **test-mode** endpoint only receives events generated by test-mode sales (`pk_test_…`); a **live-mode** endpoint only receives live events. Register the endpoint in the same mode as the traffic you want to observe. ## Event catalog You can subscribe to any of the following when you create or update a webhook. | Event | Category | When it fires | | - | - | - | | `order.completed` | Orders | A payment succeeded and a one-time order is complete. | | `order.refunded` | Orders | An order was refunded (fully or partially). | | `order.post_purchase_accepted` | Orders | A buyer added your [post-purchase offer](/selling/post-purchase-offers) in one click after checkout. The new order also arrives as `order.completed`. | | `customer.created` | Customers | A new customer record was created — on every completed sale and when you create a customer via the API. | | `review.created` | Reviews | A buyer left a product review. | | `product.created` | Products | A product was created. | | `product.updated` | Products | A product was modified. | | `product.deleted` | Products | A product was deleted. | | `payment_intent.succeeded` | Subscriptions | The **initial** subscription payment succeeded and the membership activated. | | `payment_intent.payment_failed` | Subscriptions | A subscription charge failed. Delivered alongside `invoice.payment_failed`. | | `invoice.created` | Subscriptions | A subscription charge was opened, before it settles. | | `invoice.upcoming` | Subscriptions | A renewal charge is due in 3 days — a heads-up before the card is hit. | | `invoice.payment_succeeded` | Subscriptions | A subscription charge succeeded — first charge, renewal **or** usage overage (`billingReason` says which). | | `invoice.payment_failed` | Subscriptions | A subscription payment failed (e.g. card declined) — the subscriber moves to `past_due`. | | `customer.subscription.created` | Subscriptions | A subscription activated. Fires **once**, on activation. | | `customer.subscription.updated` | Subscriptions | A subscription changed **after** activation (`past_due`, recovery, cancel-scheduled, pause, resume, cancellation). | | `customer.subscription.pause` | Subscriptions | Payment collection stopped. The buyer **keeps access**. | | `customer.subscription.resumed` | Subscriptions | A pause was lifted, or a scheduled cancel was reversed. | | `customer.subscription.trial_will_end` | Subscriptions | A trial is about to end. | | `customer.subscription.deleted` | Subscriptions | A subscription/membership was cancelled or ended. | | `subscription.payment_failed` | Retention | A renewal failed: recovery started, or a later attempt failed too. | | `subscription.recovered` | Retention | A failed renewal was paid after all. | | `subscription.saved` | Retention | A subscriber accepted a pause or discount instead of canceling. | | `subscription.upgraded` | Subscriptions | A subscriber you upgraded with `POST /subscriptions/{id}/upgrade` is on the new subscription; the old one ended at once. | | `subscription.upgrade_failed` | Subscriptions | An upgrade's charge was declined. The subscriber stays on their current subscription. | | `credit.granted` | Credits | Prepaid balance was granted (purchase or pack). | | `credit.balance_changed` | Credits | Any ledger movement: grant, usage, refill, or adjustment. | | `credit.auto_refill.succeeded` | Credits | A consented top-off charge cleared and the balance was credited. Can arrive a few seconds after the balance hits zero. | | `credit.auto_refill.failed` | Credits | A top-off charge was declined. Usage pauses; nothing retries automatically. | | `credit.top_up.succeeded` | Credits | A top-up you charged with `POST /credits/accounts/{id}/charge` was paid and added to the balance. | | `credit.top_up.failed` | Credits | A top-up you charged with `POST /credits/accounts/{id}/charge` was declined. The balance is unchanged and usage keeps working. | | `credit.consent.enabled` | Credits | A buyer turned auto-refill on. | | `credit.consent.disabled` | Credits | A buyer turned auto-refill off. | | `usage.recorded` | Usage billing | A usage report was recorded for a subscriber. | | `usage.period_closed` | Usage billing | A subscriber's billing period closed: usage totals and the overage charge. | | `funnel.lead` | Sales funnels | Someone got a funnel's free lead magnet for the first time. | | `member.joined` | Memberships | Someone became a member: their subscription to one of the membership's offers went live. | | `member.left` | Memberships | Someone stopped being a member: their subscription ended, or the membership changed or closed. | | `installment.paid` | Payment plans | A payment of a payment plan succeeded (the first one included). | | `installment.failed` | Payment plans | A later payment of a payment plan failed. The card is retried automatically. | | `ab_test.completed` | A/B tests | An A/B test ended: a winner was declared, it was stopped, or a product edit stopped it. | | `affiliate.tier_changed` | Affiliate tiers | A sale moved an affiliate into a higher commission tier (Pro). | | `loyalty.credit_redeemed` | Loyalty | A buyer spent loyalty store credit on an order (Growth). | | `split.created` | Revenue splits | A sale of a split product was recorded and split. Sent to the owner and each co-creator. | | `split.paid` | Revenue splits | A co-creator's shares were paid out. Sent to the co-creator and the owner. | | `course.completed` | Courses | A buyer finished every lesson of a course (and passed its required quizzes). Once per order. | | `certificate.issued` | Courses | A buyer got their course certificate. Once per order. | | `testimonial.submitted` | Testimonials | A buyer sent a testimonial from the request email. It waits for your approval. | | `payout.created` | Payouts | A withdrawal of your balance was requested. | | `payout.updated` | Payouts | A payout changed status: in transit, completed, failed, canceled or denied. | > [!NOTE] > > Three additional events — > `identity.verification_session.verified`, `identity.verification_session.processing`, > and `identity.verification_session.requires_input` — exist in the subscribable > event list for creator KYC / identity verification, but they are reserved for > internal use and are **not currently delivered** to webhook endpoints. Do not > build on them. ## Order events ### `order.completed` Fires when a one-time product payment succeeds (all completed sales). Delivered alongside [`customer.created`](#customer-created). ```json theme={"system"} { "product": { "id": "6949918ee8d99b0e628103e0", "variantId": null }, "order": { "id": "6a43ce05fae6c4f0cb5a2193", "paymentIntentId": "pay_Qjy4o3JnPfhHfW", "planId": "plan_MFtAtixcYzsMu" }, "currency": "usd", "customer": { "email": "buyer@example.com", "firstName": "Jane", "lastName": "Buyer" }, "tax": { "taxAmount": 0, "taxRate": 0, "ToCountry": "NL", "ToZip": "2573 NH", "ToState": "ZH", "percentage": 0, "vatNumber": null }, "amount": 1000, "amountBeforeTax": 1000, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` > [!NOTE] > > `order.id` is the Pocketsflow order/sale id; `paymentIntentId` is the > underlying processor payment id (`pay_…`). `variantId` and > `vatNumber` are `null` when not applicable. `metadata` echoes back any > `webhookMetadata` you attached at checkout, and a top-level > `clientReferenceId` echoes the `clientReferenceId`/`externalId` you supplied > (or `null`). Free orders (a > 100% discount or a free product) deliver a slightly different shape: `amount` > is `0`, `order` carries no `paymentIntentId`/`planId`, and the `tax` block > uses `amount`/`rate` keys instead of `taxAmount`/`taxRate` — don't assume > every field above is always present. When the product has [license keys](/api-reference/license-keys) turned on, the body also carries the key issued for the order: ```json theme={"system"} { "licenseKey": { "id": "6710b2c49e3f1a0012cd56ef", "key": "7KQ2M-X9D4R-T3VWB-8HNPC", "status": "active", "activationLimit": 3 } } ``` `activationLimit` is `null` for unlimited. Products without license keys send no `licenseKey` field. On a gift order the key belongs to the recipient: it is emailed to them, not to the buyer. #### Launch pricing Orders priced by an [early-bird step, a flash sale, fair pricing or a code](/api-reference/launch-pricing) carry a `pricing` object: how the price was reached, in your currency (main product, before tax). `source` is the one discount applied (`flash_sale`, `fair_pricing`, `code`) or `null`. ```json theme={"system"} { "pricing": { "listPrice": 79, "basePrice": 49, "price": 34.3, "amountOff": 44.7, "currency": "USD", "source": "flash_sale", "earlyBird": { "stepId": "step_3f9a1c2b7d4e", "index": 0, "price": 49, "nextPrice": 79 }, "flashSale": { "id": "6711d4e59e3f1a0012cd8b01", "name": "Launch week", "valueType": "percentage", "value": 30 }, "codeIgnored": false } } ``` With fair pricing, `pricing.fairPricing` carries the country, the percent and `verified: false` when the billing country collected at payment was another country. #### Gift orders When the buyer ticked **This is a gift** at checkout, `order.completed` also carries a `gift` object. `customer` is still the person who **paid**; the product belongs to `gift.recipientEmail`. If you deliver access yourself (licence keys, an external course, a community invite), send it to the recipient, not to `customer.email`. Normal orders have no `gift` key. ```json theme={"system"} { "customer": { "email": "buyer@example.com", "firstName": "Jane", "lastName": "Buyer" }, "gift": { "recipientEmail": "friend@example.com", "recipientName": "Sam Lee", "message": "Happy birthday!", "status": "delivered" } } ``` `status` is `delivered` once we emailed the recipient (or `sending` / `failed` while that is still pending). The same object is returned as `gift` on orders from the API. A refund or dispute revokes the recipient's access the same way it revokes a buyer's. ### `order.refunded` Fires when a charge is refunded (fully or partially). It replays the same `metadata` (and top-level `clientReferenceId`) the original `order.completed` carried, so you can match the refund to your own record. ```json theme={"system"} { "product": { "id": "6949918ee8d99b0e628103e0", "variantId": null }, "order": { "id": "6a43ce05fae6c4f0cb5a2193" }, "currency": "usd", "customer": { "email": "buyer@example.com" }, "tax": { "amount": 0, "rate": 0, "ToCountry": "NL", "ToZip": "2573 NH", "ToState": "ZH", "percentage": 0, "vatNumber": null }, "amount": 1000, "amountBeforeTax": 1000, "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` ### `order.post_purchase_accepted` Fires when a buyer accepts your [post-purchase offer](/selling/post-purchase-offers) and the one-click charge settles. The new order is a normal order: it also fires `order.completed` (its own `order.id`). This event links the two: `parentOrder.id` is the order the offer followed. ```json theme={"system"} { "order": { "id": "6a43ce05fae6c4f0cb5a2201", "paymentIntentId": "pay_..." }, "parentOrder": { "id": "6a43ce05fae6c4f0cb5a2193" }, "product": { "id": "665f1c2a9b3e4a0012ab34ce", "name": "Lightroom Presets" }, "parentProduct": { "id": "665f1c2a9b3e4a0012ab34cd" }, "amount": 9.6, "currency": "usd", "discountPercent": 20, "customer": { "email": "buyer@example.com" } } ``` `amount` is in major units of `currency` (9.6 = \$9.60). ## Customer & review events ### `customer.created` Fires on every completed sale (delivered next to `order.completed`) and whenever you create a customer via the API. On a sale, the payload identifies the new customer plus the related product and order: ```json theme={"system"} { "customer": { "id": "665f1c2a9b3e4a0012abaa11", "email": "buyer@example.com", "firstName": "Jane", "lastName": "Buyer", "country": "NL" }, "product": { "id": "6949918ee8d99b0e628103e0", "variantId": null }, "order": { "id": "6a43ce05fae6c4f0cb5a2193", "paymentIntentId": "pay_Qjy4o3JnPfhHfW" }, "metadata": {}, "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` When created directly via `POST /customers`, the payload is the full customer record (`_id`, `userId`, `buyerEmail`, `country`, `productId`, `testMode`, …) plus `webhookId`. ### `review.created` Fires when a buyer submits a product review. The payload is the full review record: ```json theme={"system"} { "_id": "665f1c2a9b3e4a0012abd0d0", "productId": "6949918ee8d99b0e628103e0", "buyerId": "665f1c2a9b3e4a0012abaa11", "buyerEmail": "buyer@example.com", "saleId": "6a43ce05fae6c4f0cb5a2193", "rating": 5, "review": "Fantastic — exactly what I needed.", "testMode": false, "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` ## Product events `product.created`, `product.updated`, and `product.deleted` fire from the product endpoints. Each payload is the full product document plus `webhookId`: ```json theme={"system"} { "_id": "6949918ee8d99b0e628103e0", "name": "Starter Kit", "price": 29, "description": "Everything to get going.", "published": true, "slug": "starter-kit", "userId": "auth0|68fd3a499605389e7305cdc1", "createdAt": "2026-05-01T12:00:00.000Z", "webhookId": "6a43ca9f7e229e3568f9c9bb" } ``` ## Subscription events Pocketsflow distinguishes the **initial** subscription payment from **renewals**: * The first charge that activates a membership fans out **`payment_intent.succeeded`**. * Every charge — the first one and every renewal — fans out **`invoice.created`** when it is opened, then **`invoice.payment_succeeded`** or **`invoice.payment_failed`** when it settles. `billingReason` (`initial` or `renewal`) tells the two apart. Both also record a subscription payment you can read back from [`GET /payments?type=subscription`](/api-reference/introduction#payments) (with `billingReason` of `initial` or `renewal`). > [!NOTE] > > **`customer.subscription.created` fires only on activation** — exactly once, > and it is **never** paired with `customer.subscription.updated`. (It used to > deliver both back-to-back, which made `.updated` useless as a "something > changed" signal.) `.updated` now fires only on a state change **after** > activation: `past_due`, recovery, cancel-scheduled, pause, resume, and > cancellation. If you were keying "new subscriber" off `.updated`, switch to > `.created`. Almost every subscription event carries a `paymentMethod` — the card paying for the subscription — in the same shape `order.completed` sends: ```json theme={"system"} { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 } ``` `id` is the stable per-card identifier — key on it to recognise the same card across charges. Non-card payment methods send `"paymentMethod": null`. The two events with no charge in play — `customer.subscription.deleted` and `customer.subscription.trial_will_end` — omit the card. > [!NOTE] > > **Correlation fields.** Every subscription event additionally carries three > top-level fields for binding events to your own records: > > * `subscriptionCustomerId` — the stable id of **this one subscription** (the > same value as `subscription.customerId`), present on **every** event for that > subscriber including `customer.subscription.deleted`. It identifies a > *subscription*, **not** a person — one buyer with two subscriptions has two > different ids. See [Field reference](#field-reference) below. On `invoice.*` > events fired before the subscriber record exists (the very first charge) it > is `null`. > * `clientReferenceId` — echoes back the `clientReferenceId` (or > `externalId`) you supplied at checkout, `null` when you didn't. > * `metadata` — replays the checkout metadata you attached (via checkout-URL > query params, the popup's `metadata` option, or a checkout session's > `metadata`), captured at activation. Subscriptions created before this > field existed replay `{}`. > > The JSON samples below show `"metadata": {}` for brevity — with checkout > metadata attached you get your own key/values back, e.g. > `"metadata": { "watch_id": "w_123" }`. ### Field reference Most subscription events share the same core blocks. Here's exactly what each field means so you know what to store and what to key on: **subscription.id** `string` The subscription **offer** id — the recurring product the buyer signed up to. This is shared by every buyer on that offer; it is **not** unique to one subscriber. **subscription.customerId** `string | null` The **subscriber** id — one specific buyer's single subscription to the offer above (the id of the underlying SubscriptionCustomer record). Same value as the top-level `subscriptionCustomerId`. `null` only on the very first `invoice.*` charge, before the subscriber record has been created. **subscriptionCustomerId** `string | null` The top-level, flattened copy of `subscription.customerId` — provided so you don't have to reach into the nested `subscription` block. Present on **every** event for that subscriber, including `customer.subscription.deleted`. **subscriptionCustomer** `object` The subscriber's current state — `{ id, status, active, cancelAtPeriodEnd, paused }`. Sent on `customer.subscription.created` / `.updated` only. Read this to see what the subscription now looks like rather than inferring it from the event name. **customer** `object` The buyer — `{ email, firstName, lastName }`. `customer.email` is the stable identity of the **person**; use it to recognise the same buyer across different subscriptions (see the warning below). **status** `string` The subscription's current lifecycle status: `active`, `trialing`, `past_due`, `paused`, `canceled`, … **billingReason** `string` On `invoice.*` events only: `initial` for the first charge that activates the membership, `renewal` for every recurring charge after it, `usage` for a usage-based overage charged at the end of a billing period. **paymentMethod** `object | null` The card paying for the subscription — `{ id, type, brand, last4, expMonth, expYear }` — or `null` when no card is on file or the method isn't a card. `id` (`payt_…`) is the stable per-card identifier; key on it to recognise the same card across charges. **clientReferenceId** `string | null` Echoes back the `clientReferenceId` / `externalId` you supplied at checkout, or `null` when you didn't. **metadata** `object` Your checkout metadata, replayed verbatim (e.g. `{ "watch_id": "w_123" }`). `{}` when none was attached. **portalUrl** `string` On `customer.subscription.created` / `.updated`: the buyer's self-service billing portal link — safe to email them. **webhookId** `string` Identifies the endpoint this event was delivered to. Included in the signed body — verify the signature before parsing. > [!WARNING] > > **`subscriptionCustomerId` is per-subscription, not per-customer.** It is the > id of one buyer's *single* subscription — stable for that subscription's whole > lifetime (`created` → renewals → `pause`/`resumed` → `deleted`), but **not** > shared across subscriptions. The same person subscribing to two offers — or > re-subscribing after cancelling — gets a **different** `subscriptionCustomerId` > each time. To recognise the same **person** across subscriptions, key on > `customer.email`, not `subscriptionCustomerId`. ### `payment_intent.succeeded` (initial subscription payment) ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` `subscription.id` is the subscription **offer** id; `subscription.customerId` is the subscriber (SubscriptionCustomer) id. ### `invoice.created` Fires when a subscription charge is opened, **before it settles** — the terminal outcome follows as `invoice.payment_succeeded` or `invoice.payment_failed`. On the very first charge the subscriber record does not exist yet, so `subscription.customerId` is `null`. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29.99, "currency": "usd", "paymentId": "pay_9Rt3Vc6", "billingReason": "renewal", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `invoice.upcoming` A heads-up **3 days before** the renewal charge, so you can warn the buyer (or nudge them to fix an expiring card) before the card is hit. Only subscriptions that will actually be charged produce it — cancelled, cancel-at-period-end, and paused subscriptions do not. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "active", "renewalAt": "2026-07-17T00:00:00.000Z", "daysUntilRenewal": 3, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `invoice.payment_succeeded` (first charge and renewals) Fires on the first charge, every renewal **and** every paid usage overage (`billingReason: "usage"`, once per overage order) — `billingReason` disambiguates. On the first charge `subscription.customerId` can be `null`. `trial` is `true` on a paid trial's first charge (the trial price, paid at checkout); the regular price follows as `billingReason: "renewal"` when the trial ends. It is `false` on every other charge. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29.99, "currency": "usd", "paymentId": "pay_9Rt3Vc6", "billingReason": "renewal", "trial": false, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": { "plan": "pro", "referrer": "newsletter" }, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` The initial charge — note `billingReason` and the `null` `customerId`: ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": null }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29.99, "currency": "usd", "paymentId": "pay_1Ab2Cd3", "billingReason": "initial", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `invoice.payment_failed` Fires when a subscription charge fails; the subscriber's `status` becomes `past_due`. Use it to trigger dunning emails or pause access. [`payment_intent.payment_failed`](#payment_intent-payment_failed) and [`customer.subscription.updated`](#customer-subscription-updated) are delivered alongside it. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29.99, "currency": "usd", "paymentId": "pay_8Zq5Hn2", "failureMessage": "Insufficient funds.", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `payment_intent.payment_failed` Delivered **alongside** `invoice.payment_failed` on every failed charge. Same information, plus the card that was declined. Subscribe to whichever of the two suits your integration — subscribing to both means two deliveries per failure. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29.99, "currency": "usd", "paymentId": "pay_8Zq5Hn2", "failureMessage": "Insufficient funds.", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `customer.subscription.deleted` (cancellation) Fires when a membership is deactivated/cancelled. The subscriber's `status` becomes `canceled` and `active` becomes `false`. Revoke access here. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "canceledAt": "2026-07-14T09:31:04.512Z", "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `customer.subscription.created` Fires **once**, when the subscription activates — never paired with `customer.subscription.updated`. This is the "new subscriber" signal: grant access here. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "subscriptionCustomer": { "id": "665f1a2b3c4d5e6f7a8b9c0d", "status": "active", "active": true, "cancelAtPeriodEnd": false, "paused": false }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "active", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "portalUrl": "https://app.pocketsflow.com/portal/sub_7Kq2mDx9/665f1a2b3c4d5e6f7a8b9c0d", "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` > [!NOTE] > > `subscriptionCustomer` is the current state of the subscriber: `status`, > whether they're `active`, whether a cancel is scheduled > (`cancelAtPeriodEnd`), and whether payment collection is `paused`. `portalUrl` > is the buyer's self-service billing portal — safe to email them. ### `customer.subscription.updated` Same shape as `created`. Fires on a state change **after** activation: `past_due`, recovery, cancel-scheduled, pause, resume, and cancellation. It never fires on creation. Read `subscriptionCustomer` / `status` to see what the subscription now looks like, rather than inferring it from the event name. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "subscriptionCustomer": { "id": "665f1a2b3c4d5e6f7a8b9c0d", "status": "active", "active": true, "cancelAtPeriodEnd": true, "paused": false }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "active", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "portalUrl": "https://app.pocketsflow.com/portal/sub_7Kq2mDx9/665f1a2b3c4d5e6f7a8b9c0d", "metadata": {}, "cancelAtPeriodEnd": true, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` On a failed payment the same event appends `failureMessage` instead of `cancelAtPeriodEnd`: ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "subscriptionCustomer": { "id": "665f1a2b3c4d5e6f7a8b9c0d", "status": "past_due", "active": false, "cancelAtPeriodEnd": false, "paused": false }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "past_due", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "portalUrl": "https://app.pocketsflow.com/portal/sub_7Kq2mDx9/665f1a2b3c4d5e6f7a8b9c0d", "metadata": {}, "failureMessage": "Your card was declined.", "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `customer.subscription.pause` Fires when payment collection is stopped. **The buyer keeps access** — only the charging stops, until the subscription is resumed. That's why `accessRetained` is `true` and the subscriber stays `active`. Do **not** revoke access on this event; revoke on `customer.subscription.deleted`. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "paused", "pausedAt": "2026-07-14T09:31:04.512Z", "accessRetained": true, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `customer.subscription.resumed` Fires when a pause is lifted (collection restarts) **or** a scheduled cancel is reversed — either way, the subscription will keep billing. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "active", "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `customer.subscription.trial_will_end` Fires when a trial is about to end and the first real charge is coming. ```json theme={"system"} { "subscription": { "id": "sub_7Kq2mDx9", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "status": "trialing", "trialEndsAt": "2026-07-21T00:00:00.000Z", "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ## Subscription retention events Delivered when [subscription retention](/selling/subscription-retention) is on (Pro plan). They carry the same `subscription`, `customer`, `subscriptionCustomerId`, `clientReferenceId` and `metadata` blocks as the other subscription events. ### `subscription.payment_failed` Fires when a renewal fails and failed payment recovery starts, and again on each later failed attempt of the same renewal. `recovery.nextRetryAt` is when the next scheduled attempt (day 1, 3, 5 or 7 after the first failure) runs. ```json theme={"system"} { "subscription": { "id": "665f1c2a9b3e4a0012ab34cd", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29, "currency": "usd", "paymentId": "pay_8Hq2LmZ1", "failureMessage": "Your card was declined.", "recovery": { "id": "6710b2c49e3f1a0012cd56ef", "status": "open", "amount": 29, "currency": "usd", "paymentId": "pay_8Hq2LmZ1", "firstFailedAt": "2026-10-14T09:12:00.000Z", "attempts": 1, "retryStep": 0, "nextRetryAt": "2026-10-15T09:12:00.000Z" }, "paymentMethod": { "id": "pm_4Xn8Tz1", "type": "card", "brand": "visa", "last4": "4242", "expMonth": 11, "expYear": 2029 }, "subscriptionCustomerId": "665f1a2b3c4d5e6f7a8b9c0d", "clientReferenceId": null, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `subscription.recovered` Fires once when a failed renewal is paid — by the subscriber after updating their card, or on a retry. ```json theme={"system"} { "subscription": { "id": "665f1c2a9b3e4a0012ab34cd", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "amount": 29, "currency": "usd", "paymentId": "pay_8Hq2LmZ1", "recoveredAt": "2026-10-16T08:02:11.000Z", "recovery": { "id": "6710b2c49e3f1a0012cd56ef", "status": "recovered", "amount": 29, "currency": "usd", "paymentId": "pay_8Hq2LmZ1", "firstFailedAt": "2026-10-14T09:12:00.000Z", "attempts": 2, "retryStep": 1, "nextRetryAt": null }, "paymentMethod": null, "subscriptionCustomerId": "665f1a2b3c4d5e6f7a8b9c0d", "clientReferenceId": null, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `subscription.saved` Fires when a subscriber who started to cancel in the subscriber portal accepts a save offer instead. `offer` is `pause` (with `pauseMonths` and `resumeAt`) or `discount` (with `discountPercent` for the next `discountMonths` payments). A pause also fires `customer.subscription.pause`. ```json theme={"system"} { "subscription": { "id": "665f1c2a9b3e4a0012ab34cd", "customerId": "665f1a2b3c4d5e6f7a8b9c0d" }, "customer": { "email": "ada@example.com", "firstName": "Ada", "lastName": "Lovelace" }, "reason": "too_expensive", "offer": "discount", "pauseMonths": null, "resumeAt": null, "discountPercent": 30, "discountMonths": 3, "savedAt": "2026-10-15T11:20:00.000Z", "subscriptionCustomerId": "665f1a2b3c4d5e6f7a8b9c0d", "clientReferenceId": null, "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee48" } ``` ### `subscription.upgraded` Fires when a subscriber you upgraded with `POST /subscriptions/{id}/upgrade` is active on the new subscription. The old subscription ended at the same moment (it also fires `customer.subscription.deleted`) and the new one fires `customer.subscription.created`, with the old subscription's `metadata` carried over. `chargedAmount` is the new price minus `credit` for the unused part of the old period; the new subscription renews at `newPrice` every `billingPeriodDays` from today. ```json theme={"system"} { "upgradeId": "6aee41c212ed0f16555a1b20", "from": { "subscriptionCustomerId": "665f1a2b3c4d5e6f7a8b9c0d", "subscriptionId": "665f1c2a9b3e4a0012ab34cd" }, "to": { "subscriptionCustomerId": "6aee41d912ed0f16555a1b44", "subscriptionId": "665f1c2a9b3e4a0012ab35ef" }, "currency": "usd", "credit": 6.45, "chargedAmount": 23.55, "newPrice": 30, "billingPeriodDays": 30, "paymentId": "pay_xxxxxxxxxxxxxx", "metadata": {}, "webhookId": "6612aa04bb15cc26dd37ee49" } ``` ### `subscription.upgrade_failed` Fires when an upgrade's charge, still clearing when the API answered `202`, is declined. Nothing changed: the subscriber stays on their current subscription. ## Verifying the signature Verify `X-Pocketsflow-Signature-V2` (timestamp-bound, with a 5-minute tolerance) as described in [Authentication & security](/api-webhooks/authentication-and-security#verifying-the-signature-v2-recommended), and deduplicate on `X-Pocketsflow-Event-Id`. The legacy `X-Pocketsflow-Signature` is still sent: it is `HMAC-SHA256(secret, rawBody)`, hex-encoded, where `rawBody` is the exact JSON body Pocketsflow sent (it already includes `webhookId`). Never re-serialize the parsed object before verifying — hash the raw bytes. ```javascript Node.js theme={"system"} import crypto from "crypto"; function verify(rawBody, headerSignature, secret) { const expected = crypto .createHmac("sha256", secret) .update(rawBody) // Buffer or exact string as received .digest("hex"); const a = Buffer.from(headerSignature, "utf8"); const b = Buffer.from(expected, "utf8"); return a.length === b.length && crypto.timingSafeEqual(a, b); } // Express: capture the raw body for this route // app.post("/webhooks/pocketsflow", // express.raw({ type: "application/json" }), handler); ``` ```python Python theme={"system"} import hmac, hashlib def verify(raw_body: bytes, header_signature: str, secret: str) -> bool: expected = hmac.new( secret.encode(), raw_body, hashlib.sha256 ).hexdigest() return hmac.compare_digest(header_signature, expected) ``` ```php PHP theme={"system"} [!WARNING] > > Verify against the **raw** request body. The signed body includes the > envelope (`id`, `type`, `created`) and a `webhookId` field, so re-serializing > parsed JSON can change the bytes and break the signature. ## Node.js (Express) ```javascript theme={"system"} import express from "express"; import crypto from "crypto"; const app = express(); const SECRET = process.env.POCKETSFLOW_WEBHOOK_SECRET; const TOLERANCE_SECONDS = 5 * 60; app.post( "/webhooks/pocketsflow", express.raw({ type: "application/json" }), // keep the raw Buffer async (req, res) => { const signature = req.get("X-Pocketsflow-Signature-V2") || ""; const eventId = req.get("X-Pocketsflow-Event-Id") || ""; const eventType = req.get("X-Pocketsflow-Event") || ""; const rawBody = req.body; // Buffer if (!verify(rawBody, signature, SECRET)) { return res.status(400).send("Invalid signature"); } // Retries and redeliveries reuse the event id — acknowledge and skip. if (await alreadyReceived(eventId)) { return res.status(200).send("Duplicate"); } // Acknowledge first, then process asynchronously. res.status(200).send("OK"); const event = JSON.parse(rawBody.toString("utf8")); queue.push({ eventId, eventType, event }); // hand off to a background worker } ); function verify(rawBody, header, secret) { const parts = Object.fromEntries( header.split(",").map((part) => part.split("=", 2)) ); const timestamp = Number(parts.t); if (!Number.isInteger(timestamp) || !parts.v1) return false; if (Math.abs(Math.floor(Date.now() / 1000) - timestamp) > TOLERANCE_SECONDS) { return false; } const expected = crypto .createHmac("sha256", secret) .update(`${timestamp}.`) .update(rawBody) .digest("hex"); const a = Buffer.from(parts.v1, "utf8"); const b = Buffer.from(expected, "utf8"); return a.length === b.length && crypto.timingSafeEqual(a, b); } // Worker (illustrative) — idempotent routing by event type. function handle({ eventType, event }) { switch (eventType) { case "order.completed": if (seen(event.order.id)) return; grantAccess(event.customer.email, event.product.id); markSeen(event.order.id); break; case "customer.subscription.created": // new subscriber — fires once, on activation provisionMembership(event.subscription.id, event.customer.email); break; case "invoice.payment_succeeded": // renewal if (seen(event.paymentId)) return; extendMembership(event.subscription.customerId); markSeen(event.paymentId); break; case "invoice.upcoming": // renewal is 3 days out — optional heads-up remindUpcomingCharge(event.subscription.customerId, event.renewalAt); break; case "invoice.payment_failed": startDunning(event.subscription.customerId, event.failureMessage); break; case "customer.subscription.pause": // billing stopped, access retained keepAccessNoBilling(event.subscription.customerId); break; case "customer.subscription.resumed": // billing restarted extendMembership(event.subscription.customerId); break; case "customer.subscription.deleted": revokeAccess(event.subscription.customerId); break; default: // Ignore events you don't handle. break; } } ``` ## Next.js (App Router route handler) ```typescript theme={"system"} import crypto from "crypto"; const TOLERANCE_SECONDS = 5 * 60; export async function POST(req: Request) { const raw = Buffer.from(await req.arrayBuffer()); const header = req.headers.get("x-pocketsflow-signature-v2") ?? ""; const eventId = req.headers.get("x-pocketsflow-event-id") ?? ""; const eventType = req.headers.get("x-pocketsflow-event") ?? ""; const secret = process.env.POCKETSFLOW_WEBHOOK_SECRET!; const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2))); const timestamp = Number(parts.t); const fresh = Number.isInteger(timestamp) && Math.abs(Math.floor(Date.now() / 1000) - timestamp) <= TOLERANCE_SECONDS; const expected = crypto .createHmac("sha256", secret) .update(`${timestamp}.`) .update(raw) .digest("hex"); const signature = parts.v1 ?? ""; const ok = fresh && signature.length === expected.length && crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected)); if (!ok) return new Response("Invalid signature", { status: 400 }); if (await alreadyReceived(eventId)) return new Response("Duplicate", { status: 200 }); const event = JSON.parse(raw.toString("utf8")); await enqueue(eventId, eventType, event); // don't block the response return new Response("OK", { status: 200 }); } ``` ## Python (Flask) ```python theme={"system"} import hmac, hashlib, os, time from flask import Flask, request, abort app = Flask(__name__) SECRET = os.environ["POCKETSFLOW_WEBHOOK_SECRET"].encode() TOLERANCE_SECONDS = 5 * 60 @app.post("/webhooks/pocketsflow") def pocketsflow_webhook(): raw = request.get_data() # raw bytes, before parsing header = request.headers.get("X-Pocketsflow-Signature-V2", "") event_id = request.headers.get("X-Pocketsflow-Event-Id", "") event_type = request.headers.get("X-Pocketsflow-Event", "") parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p) try: timestamp = int(parts["t"]) except (KeyError, ValueError): abort(400, "Invalid signature") if abs(int(time.time()) - timestamp) > TOLERANCE_SECONDS: abort(400, "Stale timestamp") expected = hmac.new(SECRET, f"{timestamp}.".encode() + raw, hashlib.sha256).hexdigest() if not hmac.compare_digest(parts.get("v1", ""), expected): abort(400, "Invalid signature") if already_received(event_id): return "Duplicate", 200 event = request.get_json() enqueue(event_id, event_type, event) # process in the background return "OK", 200 ``` ## PHP ```php theme={"system"} $tolerance) { http_response_code(400); exit('Invalid signature'); } $expected = hash_hmac('sha256', $timestamp . '.' . $raw, $secret); if (!hash_equals($expected, $parts['v1'] ?? '')) { http_response_code(400); exit('Invalid signature'); } if (already_received($eventId)) { http_response_code(200); exit('Duplicate'); } $event = json_decode($raw, true); enqueue($eventId, $eventType, $event); // process asynchronously http_response_code(200); echo 'OK'; ``` > [!NOTE] > > Still verifying the legacy `X-Pocketsflow-Signature` (HMAC of the raw body > only)? It keeps working — see > [Legacy signature (V1)](/api-webhooks/authentication-and-security#legacy-signature-v1). > Switch to V2 to get replay protection. ## Testing your endpoint Send a sample delivery any time with [`POST /webhooks/{id}/test`](/api-reference/introduction#webhooks) — it signs and delivers a realistic payload for the endpoint's first subscribed event to that endpoint only (even if it is disabled), with `"test": true` in the body, so you can confirm signature verification and routing end to end before going live. The response tells you what happened: ```json theme={"system"} { "message": "Test webhook delivery failed", "event": "order.completed", "eventId": "evt_5f1c2a9b3e4a0012abcd0d0e", "delivered": false, "status": 401, "durationMs": 182, "error": "HTTP 401" } ``` To re-send a real event from the delivery log, use `POST /delivered-webhooks/{id}/redeliver`. ## Example repositories Two complete, runnable examples on GitHub — clone one, drop in your IDs and signing secret, and you have a working checkout embed plus a signature-verifying webhook receiver. > [card] [Subscriptions example](https://github.com/pocketsflow/subscriptions-example) > > Embed a subscription checkout and handle `customer.subscription.*`, > `invoice.*`, and `payment_intent.*` webhooks. > [card] [One-time products example](https://github.com/pocketsflow/one-time-products-example) > > Embed a product checkout and handle `order.completed`, `order.refunded`, > and `customer.created` webhooks. ## Related topics * [Subscriptions example repo](https://github.com/pocketsflow/subscriptions-example) — runnable embed + webhook code * [One-time products example repo](https://github.com/pocketsflow/one-time-products-example) — runnable embed + webhook code * [Authentication & security](/api-webhooks/authentication-and-security) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Webhook events](/api-webhooks/events) # HTTP API design Source: https://docs.pocketsflow.com/api-webhooks/http-api-preview The design principles behind the Pocketsflow HTTP API and how it complements webhooks. > [!NOTE] > > **The HTTP API is live.** For the real, current endpoints see the > [API reference](/api-reference/introduction) and the interactive docs at > [api.pocketsflow.com/docs](https://api.pocketsflow.com/docs) (OpenAPI JSON at > [`/docs.json`](https://api.pocketsflow.com/docs.json)). This page explains the > design principles so you know what to expect as you build. Pocketsflow exposes both webhooks and a REST HTTP API. The API is REST-style with predictable, resource-based URLs, standard HTTP methods (`GET`, `POST`, `PUT`, `DELETE`), and JSON request/response bodies. ## Conventions * **Base URL:** `https://api.pocketsflow.com` — no version prefix in the path today. * **Authentication:** `Authorization: Bearer ` over HTTPS, using an API key (`pk_live_…` / `pk_test_…`) or an Auth0 JWT. * **Test vs live:** the key prefix (and your account mode) selects sandbox vs real data; the same endpoints serve both. * **Content type:** JSON everywhere except image upload (`multipart/form-data`). * **Pagination:** page-based (`page`/`pageSize` → a `pagination` envelope) or offset-based (`limit`/`offset`), depending on the resource. * **Errors:** standard HTTP status codes with a JSON `error` message. See [API reference → Making requests](/api-reference/introduction#making-requests) for the full details on pagination, errors, and rate limits. ## Resource areas The API covers, among others: * **Products** and **Checkout** — create products and hosted checkout sessions. * **Orders** and **Payments** — the sales ledger, including the unified [payments](/api-reference/introduction#payments) resource that spans one-time purchases and subscription renewals. * **Subscriptions & Subscribers** — subscription offers plus the [subscribers](/api-reference/introduction#subscriptions-and-subscribers) who buy them, with live status and payment history. * **Customers**, **Discounts**, **Upsells**, **Refunds**, **Reviews**. * **Webhooks** — register and manage event endpoints. * **Newsletters**, **Link in Bio**, **Images**, **Partners**, **Account**. ## Backwards compatibility The API evolves additively: * New fields may be added to responses at any time — treat unknown fields as optional and don't hard-code assumptions about field order. * New endpoints and event types are introduced without breaking existing ones. * Avoid depending on undocumented fields. ## Relationship to webhooks Webhooks and the HTTP API are complementary: * **Webhooks** push events to you when something happens (for example `order.completed`). * The **HTTP API** lets you query and mutate data on demand. The typical pattern: receive a webhook, then call the API to fetch additional detail or take a follow-up action — and reconcile via the API so a missed delivery self-heals. ## Related topics * [API reference](/api-reference/introduction) * [Webhooks & API overview](/api-webhooks/overview) * [Webhook events](/api-webhooks/events) # Webhooks & API overview Source: https://docs.pocketsflow.com/api-webhooks/overview How Pocketsflow webhooks and the HTTP API work together to keep your systems in sync. Pocketsflow gives you two complementary programmatic surfaces: * **Webhooks** push events to you the moment they happen — a sale completes, a subscription's initial payment or a renewal succeeds, a payment fails, a refund is issued. * The **HTTP API** lets you read and write on demand — list orders and payments, fetch subscribers, create products and checkout sessions, register webhooks, and more. Both are live today. A typical integration uses them together: react to a webhook, then call the API to fetch extra detail or take a follow-up action. > [card] [Open the interactive API reference](https://api.pocketsflow.com/docs) > > Browse every endpoint and try calls live at **api.pocketsflow\.com/docs** > (OpenAPI JSON at `/docs.json`). ## What you can do with webhooks Use events to keep external systems in step with Pocketsflow: * **Fulfil purchases** and grant access the instant `order.completed` fires. * **Manage memberships** — provision on `customer.subscription.created` (it fires exactly once, on activation), keep access on each `invoice.payment_succeeded` renewal, and revoke on `customer.subscription.deleted`. * **React to changes** — `customer.subscription.updated` fires on every change *after* activation (past due, recovery, cancel-scheduled, pause, resume). * **Run dunning** — email or pause access on `invoice.payment_failed`, and warn ahead of a renewal with `invoice.upcoming` (3 days before the card is hit). * **Handle pauses** — `customer.subscription.pause` stops billing but the buyer **keeps access**; `customer.subscription.resumed` when billing restarts. * **Sync your CRM** — capture new buyers on `customer.created`. * **Trigger refunds/returns workflows** on `order.refunded`. See [Webhook events](/api-webhooks/events) for the full catalog and payloads. ## How delivery works **1. Register an endpoint** Create a webhook in the dashboard or via [`POST /webhooks`](/api-reference/introduction#webhooks) with an HTTPS `url` and the `events` you want. You get back a signing `secret`. **2. Pocketsflow POSTs the event** When a subscribed event occurs, Pocketsflow sends a JSON `POST` to your URL with `X-Pocketsflow-Event`, `X-Pocketsflow-Event-Id`, `X-Pocketsflow-Signature-V2` (and the legacy `X-Pocketsflow-Signature`), and `X-Pocketsflow-Timestamp` headers. **3. You verify and process** Verify the timestamped HMAC-SHA256 signature against the raw body, drop event ids you've already seen, then process the event idempotently. **4. You acknowledge** Return a `2xx` within 15 seconds. Every attempt is recorded in your webhook delivery log. > [!NOTE] > > Each attempt has a **15-second timeout**; `5xx`, `429`, timeouts and > connections that never reached your endpoint are retried up to 4 attempts > in total, with the same event id. Acknowledge fast, process > asynchronously, and reconcile via the API (for example > [`GET /payments`](/api-reference/introduction#payments)) so a missed delivery > never leaves you out of sync. You can re-send a logged delivery with > `POST /delivered-webhooks/{id}/redeliver`, or a sample event to one endpoint > with [`POST /webhooks/{id}/test`](/api-reference/introduction#webhooks). ## Test vs live Webhook endpoints are scoped to the mode your account is in when you create them. A test-mode endpoint only receives events from `pk_test_…` sales; a live-mode endpoint only receives live events. Keep separate endpoints (and secrets) per mode. ## Where to go next * [API reference](/api-reference/introduction) — base URL, API keys, pagination, errors, and the complete endpoint catalog. * [Authentication & security](/api-webhooks/authentication-and-security) — verifying webhook signatures and securing your endpoint. * [Webhook events](/api-webhooks/events) — every event, when it fires, and its payload. * [Consuming webhooks](/api-webhooks/consuming-webhooks) — delivery, idempotency, and reconciliation best practices. * [Webhook examples](/api-webhooks/examples) — ready-to-adapt handler code. * [Integrations](/integrations/overview) — connect Pocketsflow to platforms like WooCommerce. # Accessing your purchases Source: https://docs.pocketsflow.com/buyers/accessing-purchases Find, open, and re-access the digital products, courses, memberships, and license keys you bought through Pocketsflow. After you buy from a creator using Pocketsflow, you'll want to reach what you paid for as quickly as possible. This guide explains every place your access can appear and what to do if something seems missing. ## Immediately after purchase Right after payment succeeds you'll typically: * See a **confirmation ("thank you") screen** with: * A success message. * A prominent **Get product / Access** button. * Any special instructions from the creator. * Sometimes a prompt to **leave a review** or **create an account**. * Receive a **confirmation email** at the address you used at checkout. We recommend: * **Clicking the access button** on the confirmation screen first. * **Saving the confirmation email** in case you need the links or your order ID later. * Checking your inbox within a few minutes if the email hasn't arrived. > [!NOTE] > > Confirmation can take a few seconds to finalize after payment. If the > thank-you screen is still processing, give it a moment before refreshing. ## Access via email Your confirmation email usually contains: * A **receipt** with the amount, product name, and order ID. * **Access** — a download link, a course/community link, login instructions, or a license key. * A **manage subscription** link (for recurring plans). If you don't see the email: * Check your **spam**, **junk**, and **promotions** folders. * Search your inbox for the **creator's name** or **"Pocketsflow"**. * Verify you used the **correct email** at checkout (a typo is the most common cause). Still nothing? Contact the creator, or see [Contact support](/buyers/contact-support). ## Access from your Pocketsflow account If you **created a free account** (or signed in) at checkout, every purchase is saved to your account. Sign in and open **Purchases** to see them all in one place. Each row shows: | Column | What it shows | | - | - | | Actions | **Get product** / **Manage subscription**, and **Invoice**. | | Order ID | A unique reference for the purchase. | | Product / Subscription | The item name and thumbnail. | | Status | Paid, or the subscription status (active, past due, cancelled…). | | Paid | The amount and currency. | | Date purchased | When you bought it. | | Next invoice | For subscriptions, the next renewal date. | | License key | For products that deliver one. | From here you can re-download a file, re-open a course or community, grab your license key, download an invoice, or (for subscriptions) open the billing portal via **Manage subscription**. > [!TIP] > > Didn't make an account at checkout? You can still create one later — use the > **same email you paid with** so your past purchases are matched to your > account. ## Types of access What "access" means depends on what you bought: > [accordion] Downloadable files > > You get one or more download links (on the thank-you screen, in your email, > and in **Purchases**). Click **Get product** to download. Save the file > locally after downloading. > [accordion] Courses > > You're taken to a course area — sometimes on a separate platform — with login > or enrollment instructions. Follow the link and sign in with the email you > purchased with where possible. > [accordion] Communities & memberships > > You get an invite or instructions to join a community space (for example > Discord or another platform). Access usually continues for as long as your > membership is active. > [accordion] License keys > > Software and licensed assets deliver a **license key**, shown on the > thank-you screen and in the **License key** column of **Purchases**. Copy it > into the app or site where it's redeemed. > [accordion] Redirect to the creator's own system > > Some products send you to the creator's own delivery page or app right after > purchase, carrying your order details along so they can grant access. ## Lost or broken access If you previously had access but now can't get in: * **Downloads:** try the original email links again, or the **Get product** button in **Purchases**. Creators occasionally update how files are delivered. * **Courses / communities:** confirm you're logging in with the email you purchased with. * **Subscriptions:** check that the subscription is still **active** — a failed renewal can suspend access until you update your card. See [Managing subscriptions](/buyers/managing-subscriptions). * **Links won't open:** try another browser or device, and disable VPNs or extensions that might interfere. When contacting the creator for help, include: * Your **name**. * The **email** you used to purchase. * Any **order or receipt ID** you have. * A short description (and a screenshot) of what's not working. ## Related topics * [How to purchase](/buyers/how-to-purchase) * [Managing subscriptions](/buyers/managing-subscriptions) * [Invoices & receipts](/buyers/invoices-and-receipts) * [Common issues](/buyers/common-issues) * [Contact support](/buyers/contact-support) # Common issues Source: https://docs.pocketsflow.com/buyers/common-issues Troubleshoot the most common problems when buying, accessing, or paying for products through Pocketsflow. Most purchases through Pocketsflow are smooth, but sometimes something goes wrong. Use this guide to fix the common issues yourself before contacting support. Each section starts with the fastest fix. ## I didn't receive a confirmation email Try this first: * Check your **spam**, **junk**, and **promotions** folders. * Search your inbox for the **creator's name** or **"Pocketsflow"**. * Confirm **which email address** you used at checkout — a typo is the most common cause. If you still can't find it, contact the creator and include: * Your **name**. * The **email** you used. * The **approximate time** of purchase and the amount. > [!TIP] > > If you created an account at checkout, you don't need the email at all — sign > in and open **Purchases** to access the product directly. See > [Accessing your purchases](/buyers/accessing-purchases). ## My payment failed or was declined Possible causes: * Insufficient funds or a spending limit. * Your card issuer blocking the transaction (common on first-time or international charges). * Incorrect billing information. * A skipped **3‑D Secure** verification step from your bank. What to try: 1. Re-check your card number, expiry, CVC, and billing postal code, then retry. 2. Complete any bank verification prompt (Verified by Visa / Mastercard Identity Check). 3. Use a **different method** if available (another card, a wallet, or crypto). 4. Contact your bank to ask whether they blocked the payment, then try again. See [Payment methods](/buyers/payment-methods) for the full decline table. If a failed attempt left a "pending" charge, it's usually a temporary hold your bank releases within a few days. ## I can't access my product Check, in order: * The **thank-you screen** from checkout, if it's still open — click **Get product**. * Your **confirmation email** for access links or a license key. * Your **Purchases** page, if you have an account. If links don't work: * Try another **browser or device**. * Turn off **VPNs** or **browser extensions** that might interfere. * For courses/communities, sign in with the **email you purchased with**. * For subscriptions, confirm the subscription is still **active** — see [Managing subscriptions](/buyers/managing-subscriptions). Still stuck? Contact the creator with your order ID and a screenshot. ## I was charged more than expected Consider: * **Currency conversion** by your bank or card issuer (their rate and fees). * **Tax / VAT**, where applicable, added on top of the listed price. * **Multiple items** — an upsell or add-on accepted at checkout, or a bundle. * A temporary **authorization hold** alongside the real charge (the hold drops off on its own). To investigate, compare your **confirmation email / invoice** with your bank statement. If you believe there's a genuine error, contact the creator first; if you can't resolve it, review the [policies](/resources/legal) and, as a last resort, contact your bank. ## I was charged twice * Check whether one line is a **pending authorization** that will disappear, and the other the real charge. * Look in **Purchases** (or your emails) for **two separate order IDs** — if there's only one order, a duplicate charge usually clears by itself. * If two real, distinct charges went through for one intended purchase, contact the creator with both statement lines and your order ID(s) to request a refund of the duplicate. See [Refunds](/buyers/refunds). ## My subscription renewed unexpectedly Subscriptions renew automatically until cancelled. If you didn't want it to renew: * Open the [billing portal](/buyers/managing-subscriptions) and **cancel** — future renewals stop and you keep access until the period ends. * For a refund of the latest charge, review the creator's refund terms and [request one](/buyers/refunds). ## A discount or coupon code won't apply * Check for **typos** and extra spaces. * Confirm the code hasn't **expired** or hit a usage limit. * Confirm it's valid for **that specific product** — some codes are product-specific. * Enter the code in the checkout's code field **before** paying. ## I want a refund Start by reviewing: * The creator's **refund terms** on the product page. * The platform-wide **Refund Policy**: `https://www.pocketsflow.com/refund-policy` Then contact the creator with your email, order/receipt ID, and a clear reason. Full details: [Buyer refunds](/buyers/refunds). ## Related topics * [How to purchase](/buyers/how-to-purchase) * [Payment methods](/buyers/payment-methods) * [Accessing your purchases](/buyers/accessing-purchases) * [Managing subscriptions](/buyers/managing-subscriptions) * [Buyer refunds](/buyers/refunds) * [Contact support](/buyers/contact-support) # Contact support Source: https://docs.pocketsflow.com/buyers/contact-support How to get help fast when something goes wrong with a purchase made through Pocketsflow — creator first, then Pocketsflow. If something isn't working with your purchase, we want you to get help quickly. This guide explains who to contact, in what order, and exactly what to include so your issue is resolved as fast as possible. ## Start with the creator Because you buy **directly from the creator**, they can resolve most issues fastest — access problems, product questions, invoice corrections, and refund requests. **1. Reply to your confirmation email** This is the quickest route — it already ties your message to your order. **2. Or use the creator's support link** Look for a **Contact** or **Support** link on the product page or the creator's website. Include: * The **email** you used at checkout. * Any **order or receipt ID** (from your email or **Purchases** page). * A **clear description** of the issue — for example "download link not working", "charged twice", "need my invoice updated with a VAT number", or "want to cancel my subscription". * A **screenshot**, if there's an error message or unexpected charge. ## Self-serve first (often faster than waiting for a reply) Many issues have an immediate fix: > [card] [Common issues](/buyers/common-issues) > > Missing email, declined payment, can't access, charged twice. > [card] [Accessing purchases](/buyers/accessing-purchases) > > Re-download files and re-open courses from your Purchases page. > [card] [Managing subscriptions](/buyers/managing-subscriptions) > > Update your card, download invoices, change plan, or cancel yourself. > [card] [Refunds](/buyers/refunds) > > Check refund terms and how to request one. ## When to contact Pocketsflow If you've tried the creator and still need help, or if something appears clearly **fraudulent or abusive**, contact the Pocketsflow team: * **Support:** `https://www.pocketsflow.com/support` * **Help Center:** `https://helpcenter.pocketsflow.com` When contacting Pocketsflow, provide: * Your **full name**. * The **email** used at checkout. * A **link to the product page**. * **Screenshots** of any error messages or unusual behavior. * Your **order/receipt IDs**. See [Help Center](/resources/help-center) for the full support hub. ## Reporting a seller If you believe a seller is violating policies — selling prohibited items, scamming, or acting fraudulently — you can report them: * **Report a seller:** `https://www.pocketsflow.com/report` For details, see [Report a seller](/resources/report-a-seller). For the rules that govern the platform, see [Resources & policies](/resources/legal). ## Check platform status If a page or checkout seems broken for everyone, it may be a known incident. Check the [status page](/resources/status) before reporting, so you know whether to simply wait for a fix. ## Related topics * [Common issues](/buyers/common-issues) * [Buyer refunds](/buyers/refunds) * [Help Center](/resources/help-center) * [Report a seller](/resources/report-a-seller) * [Resources & policies](/resources/legal) # Credit balances & auto-refill Source: https://docs.pocketsflow.com/buyers/credit-balances How prepaid balances work, what auto-refill does, and how to turn it off. Some creators sell a **Credits** product or subscription — prepaid balance instead of a one-off file. You pay once (or each billing cycle) for a credit pack, draw the balance down as you use the product, and — only if you opt in — your saved card is charged automatically to top the balance back up when it runs out. ## Auto-refill At checkout, tick **top off automatically** to opt in. The top-off amount is shown before you pay. When your balance hits zero: 1. Your saved card is charged **once** for the top-off amount. 2. The balance is credited and usage continues. If the charge fails, you get an email and the balance is **paused** — no further charges are attempted automatically, and usage stays paused until you fix payment. ## Manage or turn off Open your balance link (from your receipt email) to see the current balance, turn auto-refill off at any time, or retry a failed top-off once. Changing settings asks for your receipt email first, so a shared link alone can't flip your consent or charge your card. Turning it off stops all future charges immediately. ## Related topics * [Invoices & receipts](/buyers/invoices-and-receipts) * [Payment methods](/buyers/payment-methods) # How to purchase Source: https://docs.pocketsflow.com/buyers/how-to-purchase A step-by-step guide to buying a digital product or subscription through a Pocketsflow-powered checkout. This guide walks you through a typical purchase from a Pocketsflow-powered checkout. The exact wording, colors, and fields differ by creator, but the flow is the same everywhere. ## Before you start Have ready: * A valid **email address** you can access — this is where your receipt and access links go. * A supported **payment method** (see [Payment methods](/buyers/payment-methods)). > [!TIP] > > Buying a subscription? Skim the price, billing frequency (weekly / monthly / > yearly), and any free-trial length on the product page first, so there are no > surprises at renewal. You can cancel anytime from the > [billing portal](/buyers/managing-subscriptions). ## Step 1 — Open the product page 1. Follow the link the creator shared (social media, newsletter, link in bio, or their website). 2. Read the product description carefully: * **What you'll receive** — a download, course access, a community invite, or a license key. * **Who it's for** and what outcome it promises. * Any **guarantees, refund terms, or special conditions**. If anything is unclear, look for an FAQ on the page or a link to the creator's support before you buy. ## Step 2 — Start checkout 1. Click the primary call-to-action — for example **Buy now** or **Get access**. 2. A Pocketsflow-powered checkout opens (often embedded directly on the page). 3. Confirm the details shown: * Product name. * Price and currency. * Any discount that should apply. > [!NOTE] > > Have a discount or coupon code? Enter it in the code field at checkout before > paying. The total updates to reflect the discount. If a code doesn't apply, > check for typos, expiry, or that it's valid for that specific product. If the price or product looks wrong, go back to the product page or contact the creator before paying. ## Step 3 — Enter your details On the checkout you'll normally see: * **Email address** — used for receipts and access links. **Double-check it.** * **Name** — for receipts and personalization (sometimes optional). * **Optional fields** — such as company name, billing address, or a VAT/tax ID, depending on what the creator collects. ## Step 4 — Choose a payment method Select from the methods the creator has enabled. Depending on your country, device, and the creator's setup, you may see: * **Card** — Visa, Mastercard, and other major cards. * **Apple Pay / Google Pay** — shown automatically on supported devices and browsers. * **Bank transfer** — ACH or bank wire, where it's offered for your country. * **Crypto or card** — some checkouts support paying with crypto (on Solana) or a card. Enter your payment details in the secure fields. See [Payment methods](/buyers/payment-methods) for more. ## Step 5 — Confirm and pay 1. Review the order summary one last time. 2. Click the confirmation button to pay. 3. **Wait** for the confirmation screen — don't refresh or close the tab while it's processing. Payment confirmation can take a few seconds to finalize. If there's a problem, the checkout shows a clear message. See [Common issues](/buyers/common-issues) for declines and errors. ## Step 6 — Access your purchase After a successful payment you'll typically: * See a **confirmation ("thank you") screen** with a button to access, download, or open your product, plus any message from the creator. * Receive a **confirmation email** with your receipt and access links. * Be offered the chance to **create a free account** (or sign in) so the purchase is saved to your **Purchases** list for later. Depending on the product, "access" might be an instant download, a redirect to a course or community, or a license key. For subscriptions, the same screen confirms your plan started. > [!TIP] > > Create an account with the **same email you paid with**. Your purchase is then > linked to your account automatically, and subscriptions gain a **Manage > subscription** button. For details, see [Accessing your purchases](/buyers/accessing-purchases). ## After you buy * **Save the confirmation email.** It's often the fastest route back to your product and contains your order ID. * **Leave a review** if the thank-you screen offers one — it helps the creator and future buyers. * **Bought a subscription?** Learn how to update your card, download invoices, change plan, or cancel in [Managing subscriptions](/buyers/managing-subscriptions). ## Related topics * [Buyer overview](/buyers/overview) * [Payment methods](/buyers/payment-methods) * [Accessing your purchases](/buyers/accessing-purchases) * [Managing subscriptions](/buyers/managing-subscriptions) * [Refunds](/buyers/refunds) * [Common issues](/buyers/common-issues) # Invoices & receipts Source: https://docs.pocketsflow.com/buyers/invoices-and-receipts Find, download, and correct invoices and receipts for one-time purchases and subscriptions made through Pocketsflow. Invoices and receipts help you keep records for personal, business, or tax purposes. This guide explains every place to find them for purchases made through Pocketsflow, and how to fix a mistake in your billing details. ## Receipt vs. invoice * A **receipt** confirms a payment happened — the amount, currency, product, and date. Your confirmation email is a receipt. * An **invoice** is a more formal document, often needed for expenses or accounting, and can include your name/company, billing address, and tax details. For most personal purchases the emailed receipt is all you need. For business purchases, use the downloadable invoice described below. ## After a one-time purchase Immediately after a successful payment you receive a **confirmation email** that includes the amount paid, currency, product name, and an order reference. Keep this email — it's your primary record. ### Downloading an invoice You have two routes: > [card] From your confirmation email > > Look for a **View invoice** or **Download receipt** link, or instructions > from the creator. > [card] From your Pocketsflow account > > Sign in, open **Purchases**, find the order, and click **Invoice** to open > its invoice page, where you can view or download it. > [!TIP] > > Creating a free account with the **same email you paid with** links your > purchases to your account, so the **Invoice** action is always one click away > later. ## Subscriptions For subscriptions you get a receipt for **each billing period** — the **initial** payment when you signed up and every **renewal** afterwards. Each renewal also arrives as its own receipt email at the time it's charged. Your full payment history lives in your native **subscriber portal**, where every charge is listed in date order with its amount, date, and receipt: **1. Open your subscriber portal** Use **Manage subscription** from your **Purchases** page or a link in your subscription emails. **2. Find the charge in your payment history** The portal lists every payment on the subscription — initial and renewals — newest first. **3. View or download its receipt** Open any charge to view or download its receipt for your records. See [Managing subscriptions](/buyers/managing-subscriptions) for everything else the portal can do, and [Orders & customers](/operations/orders-and-customers) if you're the creator looking at the same payments from the dashboard. ## Correcting or updating billing details If your name, company, address, or tax ID (VAT number) is wrong: * **For subscriptions:** open your subscriber portal, choose **Manage / Update payment method** to reach the secure payment page, and update the billing details attached to your card there. Future invoices reflect the change. For anything the page doesn't let you edit, contact the creator. * **For one-time purchases:** reply to your confirmation email with the corrected information and ask the creator to re-issue the invoice. > [!NOTE] > > Some details are fixed for compliance once a transaction is processed, so a > correction may appear on future documents rather than retroactively editing a > past one. Ask the creator what's possible. ## Tax on your invoice Depending on your location and the creator's setup, your invoice may include tax such as VAT or sales tax. If you're a business with a valid tax ID, add it via **Manage / Update payment method** (for subscriptions) or ask the creator to include it, so it appears on your invoices. ## Related resources * **Invoices (marketing page):** `https://www.pocketsflow.com/invoices` ## Related topics * [Managing subscriptions](/buyers/managing-subscriptions) * [Accessing your purchases](/buyers/accessing-purchases) * [Buyer refunds](/buyers/refunds) * [Common issues](/buyers/common-issues) # Managing subscriptions Source: https://docs.pocketsflow.com/buyers/managing-subscriptions Open your native subscriber portal to view status and payment history, cancel or resume, and update your payment method for a subscription bought through a Pocketsflow-powered checkout. If you bought a subscription or membership from a creator using Pocketsflow, you can manage it yourself from a **native, branded subscriber portal** — no need to email the creator for routine changes like cancelling, resuming, or updating the card on file. This page explains where the portal is, what you can see and do in it, how to read your subscription's status, and what happens when a renewal payment fails. > [!NOTE] > > You're subscribing **directly to the creator**. Pocketsflow, with its payment > infrastructure, powers billing behind the scenes — it stores your card, > runs the renewal schedule, and retries failed charges. The creator sets the > price, billing frequency, trial length, and refund terms, within the > platform's [policies](/resources/legal). ## How to open your portal > [card] From your emails > > Every subscription email — your activation/receipt email and each renewal > receipt — carries a direct **Manage subscription** link to your portal. This > is the quickest way in. > [card] From your Pocketsflow account > > If you created an account at checkout, sign in and open **Purchases**. Find > the subscription and click **Manage subscription** to jump straight to the > portal. Your portal has its own address on the creator's Pocketsflow subdomain: ```text theme={"system"} https://creatorhandle.pocketsflow.com/portal/{subscriptionId}/{subscriptionCustomerId} ``` The link is unique to **your** subscription — it carries both the subscription's ID and your personal subscriber ID — so treat it like a private link and don't share it. You don't need a password; the link itself grants access. > [!WARNING] > > A portal link only works when it's **complete**. If you copied a truncated > link, or one that still contains placeholder text like `{subscriptionId}` or > `{subscriptionCustomerId}`, the page shows an **"invalid link"** message > instead of opening. Go back to the original email or your **Purchases** page > and use the button there. ### Creating an account to keep everything in one place After a successful purchase, the confirmation screen invites you to **create a free account or sign in**. Doing so links the purchase to your account so every order and subscription you've made through Pocketsflow appears together under **Purchases** — each row shows the product or subscription name, order ID, status, amount paid, purchase date, and next invoice date. From a subscription row, **Manage subscription** opens the portal described below. > [!TIP] > > Use the **same email** you paid with when you create your account. That's how > your past purchases get matched to you. ## What you'll see in the portal The portal opens on a branded page headed by a short message the creator wrote for you (for example, "Manage your Pro membership below"). Under it you'll find: > [accordion] Your subscription details and status > > The plan name, the price and billing frequency (weekly, monthly, or yearly), > your next billing date, and a live **status** badge — `active`, `trialing`, > `past_due`, `paused`, or `canceled`. The [status table](#understanding-your-status) > below explains each one. > [accordion] Your full payment history > > Every charge on the subscription is listed in date order — the **initial** > payment when you signed up, plus each **renewal** afterwards — with the > amount, date, and a receipt for your records. See > [Invoices & receipts](/buyers/invoices-and-receipts) for how to download them. > [accordion] Cancel, resume, and manage-payment actions > > Depending on your current status you'll see the relevant actions: **Cancel** > (schedules the subscription to end at the period end), **Resume** (undoes a > pending cancellation), and **Manage** / **Update payment method** (updates > the card on file). Each is covered in detail below. ## Understanding your status Your subscription moves through a few states over its life. The status shown in your portal comes straight from our payment infrastructure and tells you what you can and can't do. | Status | What it means | Do you have access? | | - | - | - | | `trialing` | You're inside a free trial the creator offered; not yet charged. | Yes | | `active` | Paid and renewing normally on schedule. | Yes | | `past_due` | A renewal payment failed and is being retried. | Usually, temporarily — update your card | | `paused` | Billing is paused (an action the creator takes). | No — resumes when the creator resumes it | | `canceled` | Set to end and won't renew again. | Until the end of the paid period, then no | > [!TIP] > > Only the creator can **pause** and later resume a subscription — that isn't in > your self-service portal. If you'd prefer a pause instead of a full > cancellation, [contact the creator](#need-more-help) and ask. ## Cancelling your subscription Cancelling from the portal uses **cancel-at-period-end**: you keep everything you've paid for and it simply stops renewing. **1. Open the portal** Use **Manage subscription** from your **Purchases** page or any subscription email. **2. Choose Cancel** Confirm the cancellation. The status changes to `canceled` and the portal shows the date your access ends. Some creators ask why you're leaving and may offer you a **pause** (no charges for 1–3 months, you keep access) or a **discount** on your next payments before you confirm. You can always choose **No thanks, cancel** and finish cancelling. What cancelling does: * **You keep access until the end of the period you already paid for.** You are not cut off immediately. * **No future renewals are charged.** * The status becomes `canceled` and the portal shows the exact end date. What cancelling does **not** automatically do: * It does **not** refund the current or past periods. Refunds follow the creator's policy — see [Buyer refunds](/buyers/refunds). * It does **not** delete your account or purchase history. ## Resuming a cancellation Changed your mind before the end date? As long as the period you paid for hasn't elapsed yet, you can undo the cancellation yourself. **1. Open the portal** A subscription that's set to end shows a **Resume** action while it's still within the paid period. **2. Choose Resume** The pending cancellation is removed, the status returns to `active`, and normal renewals continue on your usual billing date. > [!NOTE] > > If the period has already ended and the subscription has fully lapsed, there's > nothing left to resume — simply subscribe again, or ask the creator to > re-enable it. ## Updating your payment method Cards expire and banks occasionally decline recurring charges. Keep the card on file current to avoid losing access. **1. Open the portal and choose Manage / Update payment method** The **Manage** action hands you off to **the secure payment page** — the same infrastructure that processes your renewals — so your card details are entered directly on their PCI-compliant page, never stored by the creator. **2. Add or replace your card** Enter the new card and save it as the default for future renewals. **3. Return to your subscription** Once saved, the new card is used for the next renewal. If you were `past_due`, the next retry usually restores you to `active`. > [!WARNING] > > Update your card **as soon as** it expires or a renewal fails. While a > subscription is `past_due`, access can be suspended if the automatic retries > keep failing. ## When a renewal payment fails If a scheduled renewal charge is declined: 1. The subscription moves to **`past_due`** and the payment is retried automatically over the following days. 2. You may receive an email asking you to **update your payment method**. 3. If retries keep failing, the subscription can end and become `canceled`. If the creator uses failed payment recovery, the email has a secure link to your portal that shows the failed payment, with **Update payment method** and **Retry payment now**. The link works for 14 days and can only update your card or retry that one payment — you're never charged twice for the same renewal. To recover access quickly, open the portal, choose **Manage / Update payment method**, and add a valid card. Confirm the number, expiry, CVC, and billing postal code are correct and that the card has funds. Once a working card is on file, the next retry usually returns you to `active`. If your bank is blocking the charge, contact them and ask them to allow recurring payments to the creator, then try again. ## Refunds Cancelling stops future charges but doesn't refund past ones. Whether a specific charge in your payment history can be refunded depends on the creator's policy. See [Buyer refunds](/buyers/refunds) for how to request one and what to expect. ## Troubleshooting > [accordion] My portal link shows an 'invalid link' error > > The link is incomplete or still contains placeholder text like > `{subscriptionId}`. Don't hand-edit portal links — open the **Manage > subscription** button from your latest subscription email or your > **Purchases** page, which always builds the full, correct link. > [accordion] I don't see a Cancel or Resume button > > The available actions depend on your current status. **Resume** only appears > while a cancellation is pending and the paid period hasn't ended. **Cancel** > doesn't appear on a subscription that's already `canceled` or `paused`. If a > subscription is `paused`, only the creator can resume billing. > [accordion] I updated my card but I'm still past due > > A new card is charged on the **next retry**, not instantly. Give it a little > time, or [contact the creator](#need-more-help) and ask them to retry the > charge now. > [accordion] I cancelled but still have access > > That's expected. Cancelling is **cancel-at-period-end** — you keep access > until the paid period runs out. The portal shows the exact end date. > [accordion] I can't find my payment receipt > > Every charge — the initial payment and each renewal — is listed in the > portal's payment history with a receipt. See > [Invoices & receipts](/buyers/invoices-and-receipts). ## Need more help? If you can't complete a change in the portal, or the option you need isn't available (for example, pausing, or an early-cancellation refund): * Reply to your original confirmation email, or use the creator's support link. * Include: * The **email** you used at checkout. * The **order or subscription ID** from your receipt or **Purchases** page. * A clear description of the change you want. If you believe something is being handled unfairly, see [Report a seller](/resources/report-a-seller) and the platform [policies](/resources/legal). ## Related topics * [Accessing your purchases](/buyers/accessing-purchases) * [Buyer payment methods](/buyers/payment-methods) * [Invoices & receipts](/buyers/invoices-and-receipts) * [Buyer refunds](/buyers/refunds) * [Common issues](/buyers/common-issues) * [Contact support](/buyers/contact-support) # Buyer overview Source: https://docs.pocketsflow.com/buyers/overview Learn what Pocketsflow is, what buying through it looks like, and how to get help as a buyer. Pocketsflow is a platform creators use to sell digital products and subscriptions. This page explains what that means for **you as a buyer** — what you're buying, who you're buying from, how checkout works, and where to turn if something goes wrong. ## What is Pocketsflow? Pocketsflow provides creators with: * **Secure, hosted checkout** for digital products and memberships. * **Global payments** — cards, wallets (Apple Pay / Google Pay), crypto, bank transfer, and local methods, in many currencies. * **Delivery and receipts** — automatic access instructions and email receipts. * **A buyer account** where you can keep every purchase in one place. When you purchase, you're buying **directly from the creator**. Pocketsflow (and its payment partners) powers the payment, tax handling, and delivery experience behind the scenes — similar to how a card terminal or an app store sits between you and a merchant. ## What you can buy Creators use Pocketsflow to sell things like: * Online courses and workshops. * Guides, eBooks, and playbooks. * Notion templates and other productivity tools. * Communities and memberships (often billed as subscriptions). * Design assets — icons, wallpapers, 3D assets, UI components. * Software licenses (some products deliver a **license key**). The exact catalog depends on the creators you buy from. ## One-time products vs. subscriptions > [card] One-time products > > A single payment. You get immediate access — a download, a link, a license > key, or an invite. Nothing renews. > [card] Subscriptions & memberships > > A recurring payment (weekly, monthly, or yearly), sometimes after a free > trial. You can manage or cancel it yourself from the > [billing portal](/buyers/managing-subscriptions). ## How a typical purchase works **1. Open a product page** You land on a page the creator shared — from social media, a newsletter, a link in bio, or their own site. **2. Start checkout** Click the main call-to-action (for example **Buy now** or **Get access**). A Pocketsflow-powered checkout opens. **3. Enter your details and pay** Provide your email and payment details. Your email is where receipts and access links are sent, so double-check it. **4. Get access** On success you see a confirmation screen with an access button, and you receive a confirmation email. You can also create a free account to save the purchase. For a detailed walkthrough, see [How to purchase](/buyers/how-to-purchase). ## Where to find what you bought * **Right away:** the confirmation screen and the email receipt both contain access links or instructions. * **Later:** if you created an account, sign in and open **Purchases** to see every order and subscription in one list. See [Accessing your purchases](/buyers/accessing-purchases) for details, and [Managing subscriptions](/buyers/managing-subscriptions) if you bought a recurring plan. ## Staying safe * Check that checkout is hosted on `pocketsflow.com` (typically a creator subdomain such as `creatorname.pocketsflow.com`) or the creator's own trusted domain. * Review the product description and refund terms **before** paying. * Keep your confirmation emails — they often contain the only access links and your order IDs. * Your card details are entered on the payment provider's secure, encrypted fields. Creators never see your full card number. If something doesn't look right, you can [report it](/resources/report-a-seller). ## Getting help > [card] [Common issues](/buyers/common-issues) > > Missing email, declined payment, can't access a product, charged twice. > [card] [Refunds](/buyers/refunds) > > How refunds work and how to request one from the creator. > [card] [Contact support](/buyers/contact-support) > > Reach the creator first, then Pocketsflow if needed. > [card] [Help Center](/resources/help-center) > > Search self-serve articles for creators and buyers. ## Related topics * [How to purchase](/buyers/how-to-purchase) * [Payment methods](/buyers/payment-methods) * [Accessing your purchases](/buyers/accessing-purchases) * [Managing subscriptions](/buyers/managing-subscriptions) * [Invoices & receipts](/buyers/invoices-and-receipts) # Buyer payment methods Source: https://docs.pocketsflow.com/buyers/payment-methods Which payment methods you can use at a Pocketsflow checkout, how they are kept secure, and what to do when a payment fails. When you buy from a creator on Pocketsflow, you can pay with familiar, secure methods. The exact options you see depend on the creator's setup, your country and currency, and the device and browser you're using. ## What you can pay with > [card] Cards > > Visa, Mastercard, and other major debit/credit cards. > [card] Apple Pay / Google Pay > > Shown automatically on supported devices and browsers — pay with a saved > card and a fingerprint, Face ID, or PIN. > [card] Crypto & bank transfer > > Pay in crypto or by bank transfer (ACH or bank wire), where it's offered > for your country. > [card] Local methods (iDEAL, Bancontact, Pix, …) > > If you're in a country with a popular local method, it shows up next to > card — iDEAL in the Netherlands, Bancontact in Belgium, Pix in Brazil, and > similar options elsewhere. You'll always see at least one card option where cards are available, plus any additional methods the creator supports. Wallet buttons (Apple Pay / Google Pay) only appear when your device and browser support them and you have a card saved. ## Currency Prices are shown in the currency the creator has configured. Your bank or card issuer handles any conversion to your home currency, and may add its own conversion fee — so the amount on your statement can differ slightly from the checkout total. See [I was charged more than expected](/buyers/common-issues#i-was-charged-more-than-expected). ## Security Your payment details are handled securely by Pocketsflow's payment partners: * Sensitive card data is entered into the payment processor's own encrypted fields and sent directly to them over an encrypted connection. * **Creators never see your full card number.** * Card payments are protected by standard bank security such as 3‑D Secure (Verified by Visa, Mastercard Identity Check). If prompted, complete the verification step from your bank to approve the payment. If you have concerns about a specific charge, you can contact both the creator and Pocketsflow support — see [Contact support](/buyers/contact-support). ## If a method you want isn't available * Check that your **country and currency** are supported for that method. * Try another method shown at checkout (for example, **card** instead of crypto, or the standard card fields instead of the wallet button). * On mobile, wallet buttons require the wallet to be set up with a card first. * Ask the creator whether they can enable an alternative. ## When a payment fails or is declined Common causes and quick fixes: | Cause | What to try | | - | - | | Incorrect card details | Re-check the number, expiry, CVC, and billing postal code. | | Insufficient funds or a spending limit | Use another card or method, or contact your bank. | | Bank blocked the charge | Approve the 3‑D Secure prompt, or call your bank to allow it. | | Wallet mismatch | Ensure the card in Apple Pay / Google Pay is valid and supported. | | Network or timeout | Wait a moment and try again — don't double-submit. | If a charge appears "pending" after a failed attempt, it's usually a temporary authorization hold that your bank releases automatically within a few days. For more troubleshooting, see [Common issues](/buyers/common-issues). ## Recurring payments (subscriptions) If you bought a subscription, the payment method you used becomes the **default for renewals**. You can change it anytime, and update an expired card, from the billing portal — see [Managing subscriptions](/buyers/managing-subscriptions). If a renewal is declined, update your card promptly to avoid losing access. ## Related topics * [How to purchase](/buyers/how-to-purchase) * [Managing subscriptions](/buyers/managing-subscriptions) * [Invoices & receipts](/buyers/invoices-and-receipts) * [Common issues](/buyers/common-issues) * [Refunds](/buyers/refunds) # Buyer refunds Source: https://docs.pocketsflow.com/buyers/refunds How refunds work for purchases and subscriptions made through Pocketsflow, how to request one, and how disputes are handled. Sometimes a purchase doesn't work out as expected. This guide explains how refunds generally work when you buy from a creator using Pocketsflow, and how to request one. ## Who you're buying from When you purchase, you're buying **directly from the creator**. * Pocketsflow powers the checkout, delivery, and payment processing. * The **creator sets the refund terms** for their products, as long as those terms comply with the platform's [policies](/resources/legal). Because terms vary by creator, always check the specific product's policy first. ## Step 1 — Check the refund policy Before requesting a refund, review **both**: * The **product page** for any refund window or guarantee (for example, a "14-day money-back guarantee"). * The platform-wide **Refund Policy**: `https://www.pocketsflow.com/refund-policy` Together these describe what you can expect. Note that digital products, downloads already accessed, and used memberships may have limited eligibility — this is normal for digital goods. ## Step 2 — Contact the creator Refunds are issued by the creator, so reach out to them directly: **1. Find the creator's contact** Reply to your confirmation email, or use the support/contact link on the product page or the creator's site. **2. Include the key details** Provide your **name**, the **email** you used at checkout, any **order or receipt ID**, and a **brief, clear reason** for the request. **3. Respond to follow-ups** The creator may ask questions to understand your situation and find the best resolution. ## What happens if a refund is approved * The payment is reversed according to the creator's agreement with Pocketsflow and the payment providers. * It can take **several business days** for the refund to appear on your statement, depending on your bank or card issuer. * If a full refund isn't possible, the creator may offer a **partial refund** or another resolution (for example, store credit or a different product). For subscriptions, cancelling stops **future** charges but does not by itself refund past periods — request a refund of a specific charge separately if the creator's terms allow it. See [Managing subscriptions](/buyers/managing-subscriptions). ## Refunds on subscriptions * **Cancel** in the [billing portal](/buyers/managing-subscriptions) to prevent the next renewal. You keep access until the current period ends. * To request a refund of the **most recent charge**, contact the creator and reference the invoice from your invoice history. * A refunded subscription payment shows a **refunded** marker on the related order. ## Disputes and chargebacks If you can't resolve an issue directly with the creator: * You may be able to raise a **dispute (chargeback)** with your bank or card issuer. * Pocketsflow's **Disputes Policy** explains how these are handled: `https://www.pocketsflow.com/disputes-policy` > [!WARNING] > > Try to resolve things with the creator first. Chargebacks can take much longer > than a direct refund, and opening one may affect your ability to buy from that > creator again while it's investigated. ## If you suspect fraud If a charge is genuinely fraudulent or the seller appears to be acting in bad faith, you can also: * [Report the seller](/resources/report-a-seller). * [Contact Pocketsflow support](/buyers/contact-support). ## Related topics * [Common issues](/buyers/common-issues) * [Invoices & receipts](/buyers/invoices-and-receipts) * [Managing subscriptions](/buyers/managing-subscriptions) * [Contact support](/buyers/contact-support) * [Resources & policies](/resources/legal) # Core concepts Source: https://docs.pocketsflow.com/concepts/core-model Understand how products, subscriptions, customers, checkout, payouts, and creator tools work in Pocketsflow. Pocketsflow is a digital product platform for creators who want to sell once or earn recurring revenue from subscriptions. This page gives you a mental model for how the main pieces fit together so the rest of the docs make sense. Read it once end-to-end, then come back to it whenever a specific setting or screen is unclear. ## When to use this guide Use this guide if you are: * New to Pocketsflow and want a high-level overview. * Planning how to structure your products and offers. * Debugging an issue and trying to understand where a specific setting lives. * Building an integration and need to know which object a webhook or API field maps to. > [!NOTE] > > Payments in Pocketsflow are processed by our payment infrastructure, which also > acts as merchant of record. It handles the card form, currency conversion, > fraud checks, and the underlying subscription billing engine. Everything you > read below — products, orders, subscriptions, payouts — is Pocketsflow's model > sitting on top of that payment rail. You never touch the payment provider directly; Pocketsflow > orchestrates it for you. ## The core objects At a high level, Pocketsflow is built around a few core objects. Each one has a home in the dashboard and a matching representation in webhooks and the API. > [card] Products > > The one-time things you sell — courses, templates, downloads, licenses. > [card] Subscriptions > > Recurring offers that bill on a weekly, monthly, or yearly schedule. > [card] Customers > > The people who buy from you, deduplicated by email. > [card] Orders (Sales) > > A record of every completed payment — one-time or a subscription charge. > [card] Checkout > > The embeddable payment surface where a visitor becomes a customer. > [card] Payouts > > How Pocketsflow settles collected revenue to your bank account. ### Products Products are the one-time things you sell. Examples: * A single course. * A Notion template pack. * A downloadable asset (icons, wallpapers, 3D assets, UI components). * A license key or access code delivered by a callback URL. Key attributes: * **Type** – one-time purchase (subscriptions are a separate object; see below). * **Price & currency** – a fixed amount, "pay what you want" with a minimum, or multiple variants each with their own price. * **Content** – the file(s) buyers download, or a URL / callback they're sent to after paying. * **Page & checkout design** – one of nine public page layouts and a checkout skin (see [Page templates](/selling/page-templates) and [Checkout page](/selling/checkout-page)). * **Visibility** – published or draft, and whether a public product page shows before checkout at all. Learn more in [Product types & use cases](/selling/product-types) and [Create a product](/selling/create-product). ### Subscriptions Subscriptions represent ongoing access that renews on a schedule — **weekly**, **monthly**, or **yearly**. They are a distinct object from products because they carry billing-specific settings a one-time product doesn't have: * A **frequency** (weekly / monthly / yearly). * An optional **free trial** measured in days. * A **customer portal** where subscribers manage or cancel their plan. * A set of **subscriber records**, each with a live status (active, past due, canceled, and so on). A subscription generates a new order every billing period and emits webhooks as its state changes over time. The full walkthrough lives in [Subscriptions](/selling/subscriptions). ### Customers Customers are the people who purchase from you. A customer record is created (or matched by email) the first time someone buys, so repeat buyers don't create duplicates. Each customer record can include: * Identity information (email, first and last name, country). * Which products they've purchased. * Which subscriptions they hold, and each one's status. * Their order and payment history. Customers collected at checkout can also flow into your email audience — see [Newsletter, posts & subscribers](/selling/newsletter). ### Orders (Sales) An order — called a **Sale** internally and in the API — represents a single completed payment. Orders tie together: * The **customer** who paid. * The **product** or **subscription** they bought. * The **amount**, tax, currency, and net amount after fees. * Any **discount / coupon**, **upsell**, **affiliate**, or **partner** attribution. Every subscription renewal is also recorded as its own order, tagged with a billing reason of `initial` or `renewal`, so recurring revenue shows up on your orders page exactly like one-time sales. You'll mainly use orders when: * Looking up a specific transaction. * Issuing refunds or handling disputes. * Answering "did this payment go through?" support questions. * Reconciling payouts. ### Checkout Checkout is where a prospect becomes a customer. Pocketsflow's checkout is a single, embeddable surface used by both products and subscriptions. It handles: * Collecting the buyer's email (and optionally first / last name). * Localized payment methods and currencies, via our payment infrastructure. * Applying coupons, order bumps, and pay-what-you-want pricing. * Redirecting to a thank-you page, or — when embedded — posting a message back to the parent window so your own site can react. You configure checkout through the product/subscription's checkout step. See [Checkout page](/selling/checkout-page). ### Payouts Pocketsflow collects payment from your customers through our payment infrastructure and sends payouts to you. Key ideas: * **Payout account** – your connected bank details, set up through our payment infrastructure's onboarding. * **Business approval** – the first real (non-test) sale flags your account for a one-time business verification (KYC/KYB) before payouts continue. This is normal; complete it once and you're set. * **Fees** – the itemized transaction cost (about **4.7% + \$0.30** estimated) is deducted before payout; the net amount is stored on each order. See [Payouts](/payments/payouts), [Fees](/payments/fees), and [Payment methods](/payments/payment-methods). ### Link in bio Link in bio is your public storefront and link-in-bio hub on Pocketsflow. It's a single URL (for example, `https://yourname.pocketsflow.com`) that brings together: * **Your profile** – name, bio, profile picture, and cover image. * **Your products** – selected products displayed for visitors to browse and buy. * **Social links** – buttons linking to your social profiles. * **Regular links** – any additional links you want to share. * **Newsletter signup** – an optional subscriber form to grow your email list. * **Image gallery** – showcase your work. Key attributes: * **Templates** – 40 pre-designed layouts across six families. * **Theme customization** – colors, fonts, backgrounds, and button styles. * **Custom domain** – connect your own domain (for example, `https://yourdomain.com`). * **Analytics** – first-party page views, clicks, and top products, plus optional Google Analytics. Link in bio serves as a central hub connecting visitors to your products, content, and social presence from a single memorable URL. See [Link in bio](/selling/creator-page). ## How the objects relate ```text theme={"system"} Creator (you) ├── Products ─────────────┐ ├── Subscriptions ────────┤ │ └── Subscribers (status: active / past_due / canceled / …) │ │ Visitor → Checkout ───────┤ ▼ Order (Sale) ── belongs to ──▶ Customer │ └── rolls up into ──▶ Payout ``` * A **product** or **subscription** is what a **visitor** buys through **checkout**. * A completed checkout creates an **order** and a **customer** (or matches an existing one by email). * A subscription additionally creates a **subscriber** record that tracks its status over time and generates a new order every renewal. * Orders roll up into **payouts**. ## Lifecycle of a one-time purchase **1. Discovery** A visitor lands on a **product page** (one of nine layouts) or discovers your product via your **Link in bio**. **2. Checkout** They click your call-to-action and open the **checkout**, either as its own page or embedded on your site. **3. Payment** The buyer enters their email and card details; our payment infrastructure processes the payment. **4. Fulfillment** On success, Pocketsflow creates the **customer** and **order**, emails the buyer their access (file, link, or callback URL) plus a receipt, and notifies you of the sale. **5. Settlement** The order is included in your next **payout**, net of fees. ## Lifecycle of a subscription Subscriptions add a recurring, stateful layer on top of that flow: **1. Subscribe** The buyer completes checkout for a subscription. If you offered a **free trial**, billing is deferred until the trial ends. **2. Activation** Pocketsflow creates a **subscriber** record with status `active` (or `trialing`), grants access, and emails both buyer and you. **3. Renewals** Each billing period, our payment infrastructure charges the saved card. A successful charge records a new **order** tagged `renewal`; a failed charge moves the subscriber to `past_due` and retries. **4. Self-service** Subscribers manage or cancel their plan from the **customer portal** you link them to. **5. End of life** When a subscription is canceled or lapses, the subscriber becomes `canceled` and access is revoked at the appropriate time. ### Subscription statuses Every subscriber carries a status that reflects where they are in the billing lifecycle: | Status | Meaning | | - | - | | `trialing` | In a free trial; not yet charged. | | `active` | Paid and in good standing. | | `past_due` | A renewal charge failed; retries are in progress. | | `paused` | Temporarily suspended; not billing. | | `canceled` | Ended — either by the customer, by you, or after failed retries. | | `unpaid` | Charges have failed past the retry window. | | `incomplete` / `incomplete_expired` | The first payment never completed. | | `refunded` | A charge was refunded. | The complete subscription walkthrough, including how these transitions map to webhooks, is in [Subscriptions](/selling/subscriptions). ## Test mode Products, subscriptions, orders, and customers can be created in **test mode**. Test transactions use test cards, never move real money, are clearly flagged with a test-mode overlay on public pages, and fire test-mode webhooks. Use test mode to rehearse the full buyer journey before you send real traffic, then switch to live for launch. ## How this maps to the dashboard While the exact navigation may evolve, you can expect to see: * A **Products** section where you create and manage one-time offerings. * A **Subscriptions** section for recurring products and their subscribers. * A **Link in bio** section where you build your public storefront. * An **Orders** / **Sales** section that lists completed checkouts. * A **Customers** section for buyer records and support. * A **Payouts** / **Balance** view for pending and completed payouts. * **Posts** and **Subscribers** for the built-in newsletter. * **Settings** for account, payout, and branding configuration. As you explore these sections, refer back to this model whenever you're unsure what a setting affects. ## Glossary > [accordion] Product > > A one-time offer. Paid once, accessed forever. Distinct from a subscription. > [accordion] Subscription > > A recurring offer billed weekly, monthly, or yearly, with an optional free > trial and a self-service customer portal. > [accordion] Subscriber (SubscriptionCustomer) > > A single customer's enrollment in one subscription, with a live status and a > portal link. One person subscribing to two of your plans produces two > subscriber records. > [accordion] Order (Sale) > > A completed payment. One-time purchases produce one; subscriptions produce one > per successful billing period. > [accordion] Customer > > A person who has bought from you, deduplicated by email within your account. > [accordion] Payment infrastructure > > The payment infrastructure that processes cards, runs the recurring billing engine, > and acts as merchant of record. Pocketsflow orchestrates it; you don't manage > it directly. > [accordion] Customer portal > > The self-service page where a subscriber updates payment details, and cancels > or manages their plan. ## What's next * To launch quickly, continue to [Creator quickstart](/quickstart/creator). * To set up your public storefront, see [Link in bio](/selling/creator-page). * To design your sales flows, see [Product types & use cases](/selling/product-types). * To build recurring revenue, see [Subscriptions](/selling/subscriptions). * To understand how you get paid, see [Payments & payouts](/payments/payment-methods). # Plans and limits Source: https://docs.pocketsflow.com/concepts/plans-and-limits What each Pocketsflow plan includes, the platform fee per plan, yearly billing, feature keys, and how to handle a FEATURE_LOCKED error in the API. Every Pocketsflow account can sell from day one. Plans add growth features (custom domains, upsells, abandoned checkout recovery, affiliates and more), raise the newsletter limits, add team seats and, on the Volume plans, lower the platform fee. Selling never needs a paid plan: products, checkout, payouts, discount codes, exports, the API, webhooks, MCP and Zapier work on every plan. ## Plans | Plan | Plan id | Monthly | Yearly | Platform fee | Subscribers | Emails / month | Seats | | - | - | -: | -: | -: | -: | -: | -: | | Free | `free` | \$0 | \$0 | 2% | 1,000 | Test sends only | 1 | | Starter | `tier1` | \$15 | \$150 | 2% | 3,000 | 10,000 | 1 | | Growth | `tier2` | \$49 | \$490 | 2% | 10,000 | 40,000 | 5 | | Pro | `tier3` | \$119 | \$1,190 | 2% | 25,000 | 100,000 | 15 | | Scale | `tier4` | \$299 | \$2,990 | 2% | 75,000 | 300,000 | 50 | | Volume | `volume` | \$500 | \$5,000 | 1% | 75,000 | 300,000 | Unlimited | | Volume Max | `volume_max` | \$799 | \$7,990 | 0.5% | 75,000 | 300,000 | Unlimited | | Enterprise | `enterprise` | Contact us | Contact us | 2% | Uncapped | Uncapped | Unlimited | Each plan includes everything in the plans above it. The plan ids are what the API returns; the names are what the dashboard shows. > [!NOTE] > > The platform fee is one part of the transaction cost on each sale (see > [Pricing and fees](/payments/fees)). On Volume it is 1% and on Volume Max > 0.5% instead of 2%; the rest of the transaction cost does not change. The > rate is locked on each sale at checkout, so changing plan never rewrites > past orders. ### Yearly billing Every paid plan can be billed monthly or yearly. Yearly costs ten times the monthly price, so two months are free. Pick the interval on the billing page (**Profile → Billing**); the API reports it as `billingInterval` (`month` or `year`). ### When a paid plan ends A canceled plan keeps its features until the end of the period already paid. After that the account is on Free: features that need a plan stop working on your buyer pages (a custom domain sends buyers to your Pocketsflow subdomain, ad pixels stop loading, recovery emails stop), but nothing is deleted. Upgrading again brings everything back as it was. ## Feature keys The API names each plan feature with a key. These are the features available today and the cheapest plan that includes each one: | Feature key | Plan | What it gates | API | | - | - | - | - | | `customDomains` | Starter | Connecting your own domain | Dashboard only | | `premiumTemplates` | Starter | Premium store templates | `POST` / `PUT /creator-pages` with a premium `themeV2.templateId` | | `adPixels` | Starter | Ad tracking pixels on your buyer pages | `POST /users/update` (pixel fields) | | `upsells` | Growth | Checkout upsells (order bumps) | `POST /upsells`, `POST /upsells/{id}` | | `abandonedCheckout` | Growth | Recovery email to buyers who left checkout | `PATCH /products/{id}/abandoned-checkout` | | `affiliates` | Growth | Your affiliate program | Dashboard only | `GET /users/entitlements` returns one entry for **every** feature key, including features that are on the way (for example `trackedLinks`, `teams`, `memberships`, `lowerFee`). New keys appear as features ship, so treat unknown keys as "not needed by my integration" rather than as an error. Only turning a feature **on** is checked. Reading, turning a feature off and deleting are always allowed, so an account that moves to a smaller plan can always tidy up. > [!NOTE] > > Plan limits on the six features above are being rolled out gradually. Until > they apply, `enforced` is `false` and those features stay open to every > account (`reason: "not_enforced"`); accounts that already used them keep > them for a grace period (`reason: "grandfathered"`). Features added from now > on are checked from day one. Always read `allowed` rather than comparing > plans yourself. ## Check what an account can use Call `GET /users/entitlements` with the account's API key before you use a paid feature: ```bash theme={"system"} curl https://api.pocketsflow.com/users/entitlements \ -H "Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" ``` ```json theme={"system"} { "plan": "tier1", "planName": "Starter", "billingInterval": "year", "feeRate": 0.02, "seats": 1, "enforced": true, "features": { "customDomains": { "allowed": true, "requiredPlan": "tier1", "requiredPlanName": "Starter", "reason": "plan", "grandfatheredUntil": null }, "upsells": { "allowed": false, "requiredPlan": "tier2", "requiredPlanName": "Growth", "reason": "locked", "grandfatheredUntil": null } } } ``` | Field | Meaning | | - | - | | `plan` | The plan that applies right now. A paid plan that has ended reads `free`. | | `feeRate` | Platform fee on new sales, as a proportion (`0.02` = 2%). | | `seats` | Team seats included; `null` means unlimited. | | `enforced` | Whether plan limits apply to features that existed before plans did. | | `features..allowed` | Whether you can turn the feature on now. | | `features..reason` | `plan` (included), `grandfathered` (kept until `grandfatheredUntil`), `not_enforced` (open to everyone for now), or `locked` (needs an upgrade). | The public plans catalogue (prices, fees, caps, seats and the feature keys of each plan) needs no API key: ```bash theme={"system"} curl https://api.pocketsflow.com/users/billing-tiers ``` > [!NOTE] > > Plans are bought and changed in the dashboard only, at > [app.pocketsflow.com/profile/billing](https://app.pocketsflow.com/profile/billing). > The API never charges an account. ## The FEATURE\_LOCKED error A request that would turn on a feature the account's plan does not include answers `403` with this body. Nothing is saved. ```json theme={"system"} { "error": "FEATURE_LOCKED", "code": "FEATURE_LOCKED", "upgradeRequired": true, "message": "This feature is part of a higher plan. Please upgrade your plan to use it.", "details": { "feature": "upsells", "currentPlan": "free", "requiredPlan": "tier2", "requiredPlanName": "Growth", "requiredPlanPrice": 49, "upgradeRequired": true } } ``` How to handle it: 1. Do not retry. The same request fails until the plan changes. 2. Tell the creator which plan they need (`details.requiredPlanName`) and send them to [app.pocketsflow.com/profile/billing](https://app.pocketsflow.com/profile/billing). 3. Branch on `code`, not on `message`: the message can change and is translated in the dashboard. ```ts theme={"system"} const res = await fetch("https://api.pocketsflow.com/upsells", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ mainProductIds: ["665f1c2a9b3e4a0012ab34cd"], upsellProductId: "665f1c2a9b3e4a0012ab34ce", upsellPrice: 19, }), }); if (res.status === 403) { const body = await res.json(); if (body.code === "FEATURE_LOCKED") { // Ask the creator to upgrade; do not retry. console.log( `Upsells need the ${body.details.requiredPlanName} plan: ` + "https://app.pocketsflow.com/profile/billing", ); } } ``` Other `403` answers, such as `COUNTRY_RESTRICTED` or `ACCOUNT_BLOCKED`, are about the account, not its plan. ## Platform fee on orders Every order returns the platform fee it was charged and the rate behind it, so you can reconcile sales on the Volume plans: | Field | Meaning | | - | - | | `platformFee` | The platform fee locked at checkout, in the order currency. | | `platformFeeRate` | The rate it was charged at: `0.02`, `0.01` (Volume) or `0.005` (Volume Max). `null` on legacy sales with no platform line. | | `platformFeeSource` | `stored` (locked at checkout), `estimated` (older sale, 2% estimate), or `none`. | See [`GET /orders`](/api-reference/endpoints#orders). ## AI agents (MCP) The [MCP server](/api-reference/mcp-server) exposes the same rules as tools: `get_entitlements` (and its alias `get_plan`), `list_plans`, `get_abandoned_checkout_summary` and `set_abandoned_checkout`. Agents are told to call `get_entitlements` before using a paid feature, and a `FEATURE_LOCKED` tool error carries the plan to upgrade to and the billing link. ## Related topics * [Pricing and fees](/payments/fees) * [REST endpoint reference](/api-reference/endpoints#plans) * [Node.js SDK](/api-reference/sdk#plans-and-entitlements) * [Upsells and bundles](/selling/upsells-and-bundles) * [Custom domains](/selling/custom-domains) # Developer setup Source: https://docs.pocketsflow.com/development Set up a local environment to build against the Pocketsflow API — keys, test vs. live mode, checkout sessions, and testing webhooks locally. This guide gets you from zero to a working local development environment for the Pocketsflow HTTP API: creating keys, working in test mode, calling the API, and receiving webhooks on your machine. > [!NOTE] > > **Prerequisites** > > * A Pocketsflow account with at least one product. > * The ability to run a small server (any language) and expose it publicly for > webhook testing. ## 1. Create API keys In the dashboard, go to **Developers → API keys** and create a key. Keys are scoped to your account and come in two flavors: | Prefix | Mode | Use | | - | - | - | | `pk_test_…` | Test | Sandbox data. No real money moves. Build here first. | | `pk_live_…` | Live | Real products, customers, and payments. | Send the key as a Bearer token on every request: ``` Authorization: Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx ``` > [!WARNING] > > API keys are secrets — treat them like passwords. Keep them server-side and in > environment variables, never in client code or your repo. Use a dedicated, > revocable key per integration, and rotate if one leaks. ## 2. Base URL and the interactive reference * **Base URL:** `https://api.pocketsflow.com` * **Interactive reference (Scalar):** `https://api.pocketsflow.com/docs` * **OpenAPI spec:** `https://api.pocketsflow.com/docs.json` The OpenAPI spec is the authoritative contract — load it into your HTTP client, codegen, or AI editor's docs index. See [API reference](/api-reference/introduction). ## 3. Test vs. live mode Test mode gives you a full sandbox: * Everything you create with a `pk_test_…` key (products, checkout sessions, orders) lives in **test data**, separate from live data. * Test-mode checkouts don't move real money, and you receive **test-mode webhooks** so you can validate the whole flow. * Switch to a `pk_live_…` key only once the flow works end to end. Build and verify against test mode first; promote to live as the last step. ## 4. Make your first call Create a checkout session and get a hosted URL to redirect a buyer to: ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_test_xxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "65a1b2c3d4e5f6a7b8c9d0e1", "successUrl": "http://localhost:3000/thank-you", "cancelUrl": "http://localhost:3000/cart", "metadata": { "external_order_id": "LOCAL-1" } }' ``` ```js Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ productId: "65a1b2c3d4e5f6a7b8c9d0e1", successUrl: "http://localhost:3000/thank-you", cancelUrl: "http://localhost:3000/cart", metadata: { external_order_id: "LOCAL-1" }, }), }); const { id, url } = await res.json(); // redirect the buyer to `url` ``` The response is `{ "id": "cs_…", "url": "https://.pocketsflow.com/checkout?…" }`. Open `url` in a browser to complete a test purchase. See [Custom platforms](/integrations/custom-platforms) for the full field list. ## 5. Receive webhooks locally Webhooks are the source of truth for payment. To receive them on your machine, expose your local server with a tunnel: **1. Run your handler locally** Start your webhook endpoint (for example on `http://localhost:3000/webhooks/pocketsflow`). **2. Open a public tunnel** Use a tunneling tool to get a public HTTPS URL that forwards to your local port: ```bash theme={"system"} # examples — use whichever you have installed ngrok http 3000 # or cloudflared tunnel --url http://localhost:3000 ``` **3. Register the tunnel URL as a webhook** In **Developers → Webhooks** (or via `POST /webhooks`), point a webhook at `https:///webhooks/pocketsflow` and subscribe to events like `order.completed`. Save the **signing secret** shown once. **4. Verify the signature** On each delivery, compute HMAC-SHA256 over the RAW body with your signing secret and compare (timing-safe) to `X-Pocketsflow-Signature`. See [Consuming webhooks](/api-webhooks/consuming-webhooks). **5. Send a test event** Use **Developers → Webhooks → ⋯ → Send test** to exercise your handler without placing an order. > [!WARNING] > > Always verify against the **raw, unparsed** request body. Re-serializing the > JSON can reorder keys and break the signature check. Make handlers > **idempotent** — an event may be re-sent. ## 6. Build faster with an AI agent Point an MCP-capable editor at the [Pocketsflow MCP server](/api-reference/mcp-server) to call the API as your account while you develop, and load these docs as context. Connecting needs no API key: add the server URL, then sign in to Pocketsflow and click **Allow access**. * [MCP setup guide](/ai-tools/mcp) — Claude Desktop, Cursor, ChatGPT copy-paste * [Claude Code + Pocketsflow](/ai-tools/claude-code) * [Cursor + Pocketsflow](/ai-tools/cursor) * [Windsurf + Pocketsflow](/ai-tools/windsurf) ## Credits catalog (prepaid balance) Credits is an additive catalog type (`productType: "credits"`) on products and subscription offers. Existing clients that omit it keep working — readers fall back to the legacy `isFile` flag. Create a one-time Credits pack with optional auto-refill (`topOffCents` is integer cents — always two decimal places on the charge): ```bash cURL theme={"system"} curl -X POST [REDACTED]/products \ -H "Authorization: Bearer pk_test_xxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Studio credits", "price": 25, "productType": "credits", "creditAutoRefill": { "enabled": true, "topOffCents": 2500 } }' ``` ```js Node.js theme={"system"} const res = await fetch("[REDACTED]/products", { method: "POST", headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Studio credits", price: 25, productType: "credits", creditAutoRefill: { enabled: true, topOffCents: 2500 }, }), }); ``` The same fields exist on `POST /subscriptions` / `PATCH /subscriptions/:id`. Record usage with `POST /credits/deduct`. Subscribe to the additive credit webhook events (`credit.granted`, `credit.balance_changed`, `credit.auto_refill.succeeded`, `credit.auto_refill.failed`, `credit.consent.enabled`, `credit.consent.disabled`) — older event shapes are unchanged. See [Credit balances](/buyers/credit-balances) and [Webhook events](/api-webhooks/events#credit-events). ## Go-live checklist * [ ] Flow works end to end with a `pk_test_…` key. * [ ] Webhook signature verification passes on real deliveries. * [ ] Handlers are idempotent and reconcile via `metadata`. * [ ] Secrets are in environment variables, not in the repo. * [ ] Swapped to a `pk_live_…` key and a production webhook endpoint. ## Related topics * [Integrations overview](/integrations/overview) * [Custom platforms](/integrations/custom-platforms) * [WooCommerce](/integrations/woocommerce) * [API reference](/api-reference/introduction) * [Consuming webhooks](/api-webhooks/consuming-webhooks) * [Authentication & security](/api-webhooks/authentication-and-security) * [Credit balances](/buyers/credit-balances) # Code blocks Source: https://docs.pocketsflow.com/essentials/code How to write inline code, syntax-highlighted blocks, code groups, and API examples in Pocketsflow documentation. Clear, copy-pasteable code is central to the API and integration docs. This **contributor reference** shows every code component available on this site. ## Inline code Wrap a `word` or `phrase` in backticks: ```md theme={"system"} Wrap a `word` or `phrase` in backticks. ``` Use inline code for endpoints (`POST /checkout/sessions`), field names (`metadata`), values (`pk_test_…`), and file paths (`apps/docs/docs.json`). ## Code blocks Fence code with triple backticks and a **language** for syntax highlighting. Optionally add a **filename/title** after the language: ```javascript checkout.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ productId, successUrl, cancelUrl }), }); ``` The Markdown for the block above: ````md theme={"system"} ```javascript checkout.js const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { ... }); ``` ```` > [!TIP] > > Always set a language tag — it drives highlighting and helps screen readers. > Use realistic values (`pk_test_…`, a real endpoint), never real secrets. ## Code groups (multiple languages) Use `` to show the same task in several languages as tabs — the standard way integration examples are documented here: ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_test_xxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "65a1b2c3d4e5f6a7b8c9d0e1" }' ``` ```js Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ productId: "65a1b2c3d4e5f6a7b8c9d0e1" }), }); ``` ```php PHP theme={"system"} $response = wp_remote_post( 'https://api.pocketsflow.com/checkout/sessions', array( 'headers' => array( 'Authorization' => 'Bearer ' . POCKETSFLOW_API_KEY ), 'body' => wp_json_encode( array( 'productId' => '65a1b2c3d4e5f6a7b8c9d0e1' ) ), ) ); ``` ````md theme={"system"} ```bash cURL ... ``` ```js Node.js ... ``` ```` ## Request & response examples For API endpoint pages, `` and `` render the request and a sample response side-by-side: ```bash Create checkout session theme={"system"} curl -X POST https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_test_xxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "65a1b2c3d4e5f6a7b8c9d0e1", "metadata": { "external_order_id": "WC-1043" } }' ``` ```json 201 Created theme={"system"} { "id": "cs_9f2a…", "url": "https://yourstore.pocketsflow.com/checkout?session=cs_9f2a…" } ``` ## Highlighting, line numbers, and focus Mintlify supports meta options after the language for emphasis: ````md theme={"system"} ```js Node.js {2-3} showLineNumbers const key = process.env.POCKETSFLOW_API_KEY; // highlighted const url = "https://api.pocketsflow.com"; // highlighted ``` ```` ## Conventions for these docs * **Real, runnable examples.** Use the real base URL (`https://api.pocketsflow.com`) and realistic IDs. * **Never include real secrets.** Use `pk_test_…` placeholders and read keys from environment variables in examples. * **Keep server-side secrets server-side** in every sample — never show an API key or webhook signing secret in browser code. * **Match existing examples** — the integration guides standardize on cURL / Node.js / PHP tabs. ## Related topics * [Docs configuration](/essentials/settings) * [Images & embeds](/essentials/images) * [Custom platforms](/integrations/custom-platforms) — real code examples in context # Images & embeds Source: https://docs.pocketsflow.com/essentials/images How to add images, videos, frames, and embedded HTML to Pocketsflow documentation pages. This page shows how to add images, video, and other embedded elements to documentation pages. It's a **contributor reference** for editing these docs. ![Example banner image rendered in a Frame](https://mintlify-assets.b-cdn.net/bigbend.jpg) ## Adding an image ### Markdown syntax The simplest way — good for inline content: ```md theme={"system"} ![Alt text describing the image](/images/example.png) ``` Store local images under `apps/docs/images/` and reference them with an absolute-from-root path (`/images/...`). > [!NOTE] > > Local image files must be **under 5 MB**. For larger assets, host them on a > CDN or object store (Cloudinary, S3, or the Pocketsflow CDN) and embed the > URL. ### HTML for more control Use an `` tag when you need sizing, rounded corners, or other attributes: ```html theme={"system"} Creator dashboard showing recent orders ``` ### Wrap images in a Frame Prefer `` for screenshots and diagrams — it adds consistent padding, a border, and an optional caption: ```jsx theme={"system"} Orders list with status and amount columns ``` ![Landscape example inside a captioned Frame](https://mintlify-assets.b-cdn.net/bigbend.jpg) A Frame gives images a consistent, bordered presentation ## Accessibility & style * **Always write descriptive `alt` text.** Say what the image shows, not "image". * Match the flat Pocketsflow style: rounded corners are fine; avoid heavy drop shadows. * Use light-and-dark-friendly screenshots where possible, or provide both. * Keep file names lowercase and hyphenated (`orders-list.png`). ## Light & dark variants To swap an image by theme, provide both and let Mintlify pick, or use HTML classes: ```html theme={"system"} Architecture diagram Architecture diagram ``` ## Videos Self-hosted video: ```html theme={"system"} ``` Embedded YouTube: ```html theme={"system"} ``` [YouTube video player](https://www.youtube.com/embed/4KzFe50RQkQ) ## Other embeds (iframes) Any HTML iframe works — dashboards, forms, or interactive demos: ```html theme={"system"} ``` > [!TIP] > > Mintlify supports HTML tags directly in MDX, so you can mix Markdown and HTML > freely for full flexibility. ## Related topics * [Docs configuration](/essentials/settings) * [Code blocks](/essentials/code) # Docs configuration (docs.json) Source: https://docs.pocketsflow.com/essentials/settings How the Pocketsflow docs site is configured — the docs.json schema, navigation, theming, and where to change things. The Pocketsflow documentation site is built with [Mintlify](https://mintlify.com). Every setting — navigation, theme, logo, footer — lives in a single `docs.json` file at the docs root (`apps/docs/docs.json`). This page documents the structure actually in use so contributors can add pages and adjust the site confidently. > [!NOTE] > > This is a **contributor reference** for editing these docs, not a product > feature. If you're looking for your Pocketsflow **account** settings, see > [Account & security](/operations/account-and-security). ## Where things live ``` apps/docs/ ├── docs.json # all configuration (this page) ├── index.mdx # docs home ├── quickstart.mdx ├── buyers/ # buyer guides ├── selling/ # creator selling guides ├── integrations/ # integration guides ├── api-reference/ # API reference pages ├── api-webhooks/ # webhooks docs ├── ai-tools/ # AI editor setup ├── essentials/ # these contributor pages └── resources/ # policies & support ``` ## Top-level keys **\$schema** `string` Points at the Mintlify schema for editor validation: `https://mintlify.com/docs.json`. **theme** `string` The Mintlify theme. This site uses `mint`. **name** `string` *required* The site name shown in the title. Here: `Pocketsflow Docs`. **colors** `object` *required* Brand colors. The docs follow the marketing site (`apps/landing-new`): monochrome, black on white and `#ededed` on near-black. ```json theme={"system"} "colors": { "primary": "#000000", "light": "#ededed", "dark": "#000000" } ``` > [!WARNING] > > Keep the docs monochrome to match [www.pocketsflow.com](http://www.pocketsflow.com). Don't add a colour > accent without a brand decision. **background** `object` Page background per mode: `#ffffff` in light, `#0a0a0a` in dark (the same values as the marketing site). **fonts** `object` Satoshi for headings and body, self-hosted from `/fonts/satoshi-var.woff2` (the same file the marketing site serves). Code is set in Geist Mono by `style.css`. **favicon** `string` Path to the favicon: `/favicon.svg`, the square "PF" monogram. **logo** `object` Light and dark logo paths: ```json theme={"system"} "logo": { "light": "/logo/light.svg", "dark": "/logo/dark.svg" } ``` Both are the "Pocketsflow" wordmark in Averia Serif Libre 700, converted to outlines so they render without loading a font. Regenerate them from `apps/landing-new/public/brand/pf-logo-text.svg` if the wordmark changes. **navigation** `object` *required* The site's structure — tabs, groups, and pages. See [Navigation](#navigation) below. **navbar** `object` Top-bar links and the primary call-to-action button: ```json theme={"system"} "navbar": { "links": [ { "label": "Pricing", "href": "https://www.pocketsflow.com/pricing" }, { "label": "Support", "href": "https://www.pocketsflow.com/support" } ], "primary": { "type": "button", "label": "Sign in", "href": "https://app.pocketsflow.com" } } ``` **contextual** `object` The "copy / open in AI tool" options on each page. This site enables: `copy`, `view`, `chatgpt`, `claude`, `perplexity`, `mcp`, `cursor`, `vscode`. **footer** `object` Footer socials, e.g. `{ "socials": { "x": "https://x.com/pocketsflow" } }`. ## Navigation Navigation is a set of **tabs**, each containing **groups**, each containing an ordered list of **pages** (paths relative to the docs root, without `.mdx`). ```json theme={"system"} "navigation": { "tabs": [ { "tab": "Guides", "groups": [ { "group": "For buyers", "pages": [ "buyers/overview", "buyers/how-to-purchase", "buyers/managing-subscriptions" ] } ] } ] } ``` **tab** `string` *required* The tab label shown in the top navigation (e.g. `Guides`, `Integrations`, `Resources`). **group** `string` *required* A section heading within a tab's sidebar (e.g. `For buyers`). **pages** `string[]` *required* Ordered page paths relative to the docs root. `buyers/overview` → `buyers/overview.mdx`. Order here is the sidebar order. ### Adding a page **1. Create the MDX file** Add `your-section/your-page.mdx` with valid frontmatter (see [Writing pages](#page-frontmatter)). **2. Register it in docs.json** Add its path to the right group's `pages` array, in the position you want it to appear. **3. Preview** Run the local preview and confirm it shows in the sidebar and renders. > [!WARNING] > > A page that isn't listed in any `pages` array is **orphaned** — reachable by > direct URL but missing from the sidebar. Always register new pages. ## Global anchors `navigation.global.anchors` renders persistent links (with icons) across the whole site: ```json theme={"system"} "global": { "anchors": [ { "anchor": "Pocketsflow", "href": "https://www.pocketsflow.com", "icon": "globe" }, { "anchor": "Status", "href": "https://app.pocketsflow.com/status", "icon": "signal" }, { "anchor": "Blog", "href": "https://www.pocketsflow.com/blog", "icon": "newspaper" } ] } ``` ## Page frontmatter Every MDX page starts with YAML frontmatter: ```yaml theme={"system"} --- title: 'Clear, specific page title' description: 'One concise sentence for SEO and the sidebar/preview.' icon: 'gear' # optional Font Awesome icon --- ``` ## Validating your changes * Preview locally with the Mintlify CLI: `mint dev` (installed via `npm i -g mint`), served at `http://localhost:3000`. * Check for broken links with `mint broken-links`. * Ensure `docs.json` remains **valid JSON** (a trailing comma will break the build). ## Related topics * [Images & embeds](/essentials/images) * [Code blocks](/essentials/code) # Welcome to Pocketsflow Docs Source: https://docs.pocketsflow.com/index Everything you need to build, sell, and support digital products and subscriptions with Pocketsflow. Pocketsflow is a digital product platform that helps creators sell products and subscriptions globally with a transparent transaction cost made up of the Pocketsflow platform, payment infrastructure fee, tax handling when required, and dispute prevention (4.7% + \$0.30 estimated, about \$5.00 on \$100; itemized on every order) and no monthly cost. The platform includes tools most competitors charge extra for: built-in email marketing, affiliates, upsells, global payments, and Merchant-of-Record tax handling so you never touch a VAT return. This documentation is your guide to launching, scaling, and supporting your business on Pocketsflow. ## Choose your path > [card] [I’m a creator](/quickstart/creator) > > Go from signing up to making your first sale in about 15 minutes. > [card] [I’m a buyer](/buyers/overview) > > Learn how buying through Pocketsflow works and where to get help. ## For creators Design your offers, set up checkout, and get paid reliably. > [card] [Understand the core model](/concepts/core-model) > > Learn how products, customers, orders, subscriptions, and payouts fit together. > [card] [Create and launch products](/selling/create-product) > > Step-by-step guide to creating products and publishing high-converting pages. > [card] [Set up payments & payouts](/payments/payment-methods) > > See which payment methods and countries are supported and how payouts work. > [card] [Grow revenue](/selling/upsells-and-bundles) > > Use subscriptions, upsells, and bundles to increase lifetime value. ## For buyers If you purchased from a creator using Pocketsflow, start here. > [card] [How to purchase](/buyers/how-to-purchase) > > See what to expect when checking out. > [card] [Access your purchases](/buyers/accessing-purchases) > > Learn where to find downloads, courses, and memberships. > [card] [Manage subscriptions](/buyers/managing-subscriptions) > > Update payment methods, change plans, or cancel. > [card] [Get help](/buyers/contact-support) > > Contact the creator or Pocketsflow support if something goes wrong. ## For developers Connect Pocketsflow to your own systems with the API and webhooks. > [card] [API reference](/api-reference/introduction) > > Base URL, API keys, and the full interactive reference at api.pocketsflow\.com/docs. > [card] [Integrations](/integrations/overview) > > Connect platforms like WooCommerce using checkout sessions and webhooks. > [card] [Developer setup](/development) > > Get API keys, call the API in test mode, and receive webhooks locally. > [card] [MCP server & AI tools](/ai-tools/mcp) > > Connect Claude, Cursor, or ChatGPT in minutes: add the URL, sign in, and click Allow access. No API key needed. > [card] [Subscriptions example](https://github.com/pocketsflow/subscriptions-example) > > Runnable embed + webhook code for selling subscriptions from your own site. > [card] [One-time products example](https://github.com/pocketsflow/one-time-products-example) > > Runnable embed + webhook code for selling one-time products from your own site. ## Platform status & policies > [card] [Status](/resources/status) > > Check live platform status and subscribe to incident updates. > [card] [Help Center](/resources/help-center) > > Search self-serve articles and reach support. > [card] [Resources & policies](/resources/legal) > > Review the policies and agreements that govern use of Pocketsflow. # Custom platforms Source: https://docs.pocketsflow.com/integrations/custom-platforms The generic redirect + webhook pattern to integrate Pocketsflow with any store, platform, or no-code tool. The [WooCommerce guide](/integrations/woocommerce) is one concrete example of a general pattern that works for **any** platform — a custom storefront, a Shopify app, a membership site, or a no-code tool. This page distills that pattern with language-agnostic examples. ## The two calls you need **1. Create a checkout session, then redirect** Server-side, call `POST /checkout/sessions` and send the buyer to the `url` in the response. Put your own order/cart id in `metadata`. **2. Confirm via the order.completed webhook** When the webhook fires, verify the signature and read your id back out of `metadata` to settle the matching order. ## 1. Create a checkout session ```bash cURL theme={"system"} curl -X POST https://api.pocketsflow.com/checkout/sessions \ -H "Authorization: Bearer pk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "productId": "65a1b2c3d4e5f6a7b8c9d0e1", "successUrl": "https://store.example.com/thank-you", "cancelUrl": "https://store.example.com/cart", "customerEmail": "buyer@example.com", "metadata": { "external_order_id": "ORDER-1043" } }' ``` ```js Node.js theme={"system"} const res = await fetch("https://api.pocketsflow.com/checkout/sessions", { method: "POST", headers: { Authorization: `Bearer ${process.env.POCKETSFLOW_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ productId: "65a1b2c3d4e5f6a7b8c9d0e1", successUrl: "https://store.example.com/thank-you", cancelUrl: "https://store.example.com/cart", customerEmail: order.email, metadata: { external_order_id: order.id }, }), }); const { url } = await res.json(); // Redirect the buyer to `url`. ``` ```php PHP theme={"system"} $response = wp_remote_post( 'https://api.pocketsflow.com/checkout/sessions', array( 'headers' => array( 'Authorization' => 'Bearer ' . POCKETSFLOW_API_KEY, 'Content-Type' => 'application/json', ), 'body' => wp_json_encode( array( 'productId' => '65a1b2c3d4e5f6a7b8c9d0e1', 'successUrl' => 'https://store.example.com/thank-you', 'cancelUrl' => 'https://store.example.com/cart', 'metadata' => array( 'external_order_id' => $order_id ), ) ), ) ); $body = json_decode( wp_remote_retrieve_body( $response ), true ); // header( 'Location: ' . $body['url'] ); ``` | Field | Required | Notes | | - | - | - | | `productId` | Yes | A Pocketsflow product **or subscription offer** owned by your account. Pass either kind of id here. | | `successUrl` | No | Absolute `http(s)` URL the buyer returns to after paying. | | `cancelUrl` | No | Absolute `http(s)` URL if they abandon checkout. | | `customerEmail` | No | Prefills the buyer's email on the checkout (and inside the payment form), and is attached to the resulting order. | | `lockEmail` | No | With `customerEmail`, makes the prefilled email read-only so the buyer can't change the address you keyed your records on. | | `clientReferenceId` | No | Your own correlation id (max 256 chars). Echoed back **top-level** as `clientReferenceId` on the resulting webhooks — including every subscription lifecycle event. | | `discountCode` | No | A discount code to pre-apply. | | `metadata` | No | Arbitrary key/values, echoed back on the order + webhooks. For subscriptions, the metadata is captured at activation and replayed on every `customer.subscription.*` / `invoice.*` event. | The response is `{ "id": "cs_…", "url": "https://yourstore.pocketsflow.com/checkout?…" }`. ## Payment methods (no extra parameter) Payment methods on the hosted checkout URL are the methods offered on the seller's account: cards, wallets (Apple Pay, Google Pay), ACH, and local methods such as iDEAL that show automatically to buyers in those countries. You do **not** pass a payment-method field on `POST /checkout/sessions` — there isn't one. Availability still depends on the buyer's device, country, and what the payments partner can offer on your account. Set **3D Secure** under **Settings → Checkout**. If you embed the checkout in an iframe on your own site (instead of redirecting), include `allow="payment *; publickey-credentials-get *"` on that iframe so Apple Pay and Google Pay can render. The popup script used for inline embeds sets this for you. The wallets also need your site's domain added under **Settings → Checkout** (see [Wallets on your own website](/payments/payment-methods#wallets-on-your-own-website)). ## 2. Verify and handle the webhook Every webhook is an HTTP `POST` signed with HMAC-SHA256 over the raw body, keyed with your endpoint's signing secret. Verify it before trusting the payload. ```js Node.js (Express) theme={"system"} import express from "express"; import crypto from "crypto"; const app = express(); app.post( "/webhooks/pocketsflow", express.raw({ type: "application/json" }), (req, res) => { const signature = req.header("X-Pocketsflow-Signature"); const expected = crypto .createHmac("sha256", process.env.POCKETSFLOW_WEBHOOK_SECRET) .update(req.body) // raw Buffer .digest("hex"); if ( !signature || !crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected)) ) { return res.status(400).send("Invalid signature"); } const event = req.header("X-Pocketsflow-Event"); const payload = JSON.parse(req.body.toString("utf8")); const orderId = payload.metadata?.external_order_id; if (event === "order.completed" && orderId) { markOrderPaid(orderId); // idempotent } res.status(200).send("OK"); } ); ``` ```php PHP theme={"system"} $raw = file_get_contents( 'php://input' ); $signature = $_SERVER['HTTP_X_POCKETSFLOW_SIGNATURE'] ?? ''; $expected = hash_hmac( 'sha256', $raw, POCKETSFLOW_WEBHOOK_SECRET ); if ( ! hash_equals( $expected, $signature ) ) { http_response_code( 400 ); exit( 'Invalid signature' ); } $event = $_SERVER['HTTP_X_POCKETSFLOW_EVENT'] ?? ''; $payload = json_decode( $raw, true ); $orderId = $payload['metadata']['external_order_id'] ?? null; if ( $event === 'order.completed' && $orderId ) { mark_order_paid( $orderId ); // idempotent } http_response_code( 200 ); echo 'OK'; ``` ## Best practices * **Verify against the raw body.** Don't re-serialize the JSON before hashing. * **Be idempotent.** A webhook may be re-sent; processing the same event twice must be safe (check whether the order is already paid first). * **Acknowledge fast.** Return `2xx` quickly and do heavy work asynchronously. * **Reconcile.** Treat the webhook as the source of truth; if one is missed, use `GET /orders` and match on your `metadata` id. * **Keep secrets server-side.** API keys and signing secrets must never reach the browser. ## A note on Shopify and marketplace apps The same redirect + webhook pattern works for a custom Shopify integration today. A deeper, no-code "native app" experience (one-click connect, automatic product sync) for WooCommerce, Shopify, and others is planned — see the [integrations overview](/integrations/overview) for what's available now. ## Related topics * [WooCommerce guide](/integrations/woocommerce) * [API reference](/api-reference/introduction) * [Webhook events](/api-webhooks/events) * [Consuming webhooks](/api-webhooks/consuming-webhooks) # Framer Source: https://docs.pocketsflow.com/integrations/framer Add a Pocketsflow buy button, link or product card to a Framer site with a code component and its property controls. The Pocketsflow code component puts a buy button, a link or a product card on any Framer page. Set it up once, then configure each instance from Framer's properties panel. ## Install **1. Copy the component** In the dashboard, open **Integrations → Site builders**, choose **Framer** and click **Copy component code** (or **Download**). **2. Add it to your project** In Framer, open **Assets → Code**, click **+** and create a **new file**. Name it `PocketsflowBuyButton`, replace its contents with the copied code and save. **3. Place it** Drag **PocketsflowBuyButton** from Assets onto the canvas and fill in its properties. The dashboard lists the exact values to type. **4. Publish** The checkout opens on your published site and in Framer's preview. On the canvas, a click selects the layer instead. ## Properties | Property | What it does | | - | - | | **Store** | Your subdomain (`yourstore`) or your custom domain (`shop.example.com`). | | **Product ID** | The product or subscription to sell. | | **Type** | Product or Subscription. | | **Style** | Button, Link or Card. | | **Label** | The button text. | | **Checkout** | Overlay (on top of the page) or New tab. | | **Button**, **Text**, **Radius**, **Font** | The button's colour, text colour, corner radius and font. | A **Card** reads the product's public name, price and cover from the Pocketsflow API. No API key is needed or stored in Framer. Subscriptions show as a button. ## Framer Marketplace Framer lists components and plugins in its Marketplace after Framer reviews them. Until a Pocketsflow listing is published there, the code component above is the way to add Pocketsflow to a Framer site; it is the same component a listing would install. ## For developers The component source lives in the monorepo at `integrations/framer/PocketsflowBuyButton.tsx`. It loads the same [embed script](/selling/embed-buy-button) as every other integration. # Integrations overview Source: https://docs.pocketsflow.com/integrations/overview Connect Pocketsflow to external stores and platforms using the API and webhooks. You can connect Pocketsflow to almost any external store, platform, or internal tool using two building blocks: 1. **The HTTP API** — to create checkout sessions and read/write data. 2. **Webhooks** — to react when something happens (a sale completes, a subscription renews, a refund is issued). This section shows how to combine them into a working integration, with a complete [WooCommerce](/integrations/woocommerce) example and a [generic pattern](/integrations/custom-platforms) you can adapt to any platform. ## The building blocks > [card] [API keys](/api-reference/introduction) > > Authenticate server-to-server with a `pk_live_…` / `pk_test_…` key. > [card] [Checkout sessions](https://api.pocketsflow.com/docs) > > `POST /checkout/sessions` returns a hosted URL to redirect buyers to. > [card] [Webhooks](/api-webhooks/events) > > Subscribe to events like `order.completed` and `customer.created`. > [card] [Metadata](/integrations/custom-platforms) > > Attach your own IDs so you can correlate Pocketsflow orders with yours. ## Example repositories Clone a complete, runnable example — a checkout embed plus a signature-verifying webhook receiver — and adapt it to your platform. > [card] [Subscriptions example](https://github.com/pocketsflow/subscriptions-example) > > Embed a subscription checkout and handle the subscription lifecycle webhooks. > [card] [One-time products example](https://github.com/pocketsflow/one-time-products-example) > > Embed a product checkout and handle `order.completed` / `order.refunded` webhooks. ## The standard pattern Almost every "sell through my own store / platform" integration follows the same five steps: **1. Create an API key** In the dashboard, go to **Developers → API keys** and create a key. Store it as a secret on your server. **2. Map your products to Pocketsflow products** Each item you sell maps to a Pocketsflow `productId`. Create products in the dashboard or via `POST /products`, and store the resulting `productId` alongside your own product records. **3. Create a checkout session at purchase time** When a buyer checks out, call `POST /checkout/sessions` with the `productId`, your `successUrl` / `cancelUrl`, and a `metadata` object containing **your** order id. Redirect the buyer to the `url` you get back. **4. Let the buyer pay on Pocketsflow** Pocketsflow hosts the checkout and handles payment, tax, and receipts. After payment the buyer is redirected to your `successUrl`. **5. Confirm the sale with a webhook** Register a webhook for `order.completed`. When it fires, verify the signature, read your order id back out of `metadata`, and mark the order paid in your system. ## Why metadata matters The `metadata` you pass when creating a checkout session is **echoed back** on the resulting order and in every related webhook payload. This is how you correlate a Pocketsflow order with the order in your own system — without it, you'd have no reliable way to know which of your orders a webhook refers to. ```json theme={"system"} // Request: POST /checkout/sessions { "productId": "65a1b2c3d4e5f6a7b8c9d0e1", "successUrl": "https://store.example.com/thank-you", "cancelUrl": "https://store.example.com/cart", "metadata": { "external_order_id": "WC-1043" } } ``` ```json theme={"system"} // Later: the order.completed webhook payload echoes it back { "order": { "id": "...", "amount": 4900, "currency": "usd" }, "customer": { "email": "buyer@example.com" }, "metadata": { "external_order_id": "WC-1043" } } ``` ## Develop and test locally Build against a `pk_test_…` key first so no real money moves, then promote to `pk_live_…`. To receive webhooks on your machine, expose your local server with a tunnel (ngrok, cloudflared) and register the public URL as a webhook endpoint. The full walkthrough — keys, first call, tunnel, signature verification, and a go-live checklist — is in [Developer setup](/development). > [!TIP] > > Building the integration with an AI editor? Start with the > [MCP setup guide](/ai-tools/mcp) so the agent can call the API as your > account, and give it these docs as context — see > [Claude Code](/ai-tools/claude-code), [Cursor](/ai-tools/cursor), and > [Windsurf](/ai-tools/windsurf). ## Common questions > [accordion] How do I match a webhook to my order? > > Read your own id back out of `metadata` (for example > `metadata.external_order_id`). It's echoed on the order and every related > webhook. Never rely on ordering or timing. > [accordion] What if a webhook is missed? > > Treat webhooks as the source of truth, but reconcile as a backstop: list > recent orders via the API and match on your `metadata` id. Keep handlers > idempotent so a re-send is safe. > [accordion] Can I integrate a platform not listed here? > > Yes — the [custom platforms](/integrations/custom-platforms) pattern (create > a checkout session, redirect, confirm via webhook) works for any store, > membership site, or no-code tool. ## Pick a guide > [card] [WooCommerce](/integrations/woocommerce) > > A complete, step-by-step WooCommerce integration with PHP examples. > [card] [Any other platform](/integrations/custom-platforms) > > The generic redirect + webhook pattern, with Node and PHP examples. > [card] [Developer setup](/development) > > Keys, test mode, first API call, and local webhook testing. > [card] [MCP setup guide](/ai-tools/mcp) > > Build and operate your store with an AI agent. # Site builders Source: https://docs.pocketsflow.com/integrations/site-builders Sell from WordPress, Framer and Webflow: a buy button, link or product card that opens your Pocketsflow checkout on top of the page. Put your Pocketsflow products on the site you already have. Pick a product, pick a style, copy one thing into your site builder. Buyers pay in the Pocketsflow checkout on top of your page, and tax, receipts and payouts stay in Pocketsflow. Free on every plan. > [!TIP] > > In the dashboard, open **Integrations → Site builders**. Pick a product and a > style, then copy what your builder needs: the WordPress shortcode, the Framer > properties or the Webflow embed code. > [card] [WordPress](/integrations/wordpress) > > A plugin with a block, a shortcode and a product picker. > [card] [Framer](/integrations/framer) > > A code component with property controls. > [card] [Webflow](/integrations/webflow) > > A copy-paste Code Embed, made for you in the dashboard. ## Three styles | Style | What buyers see | | - | - | | **Button** | A Pocketsflow button (brand blue, 40px tall). | | **Link** | A text link in your site's own style. | | **Card** | A product card: cover, name, price and a button. One-time products only; a subscription shows as a button. | ## Overlay or new tab By default the checkout opens on top of your page and the buyer never leaves it. Choose **New tab** to open the checkout in a new tab instead. On screens narrower than 560px the checkout always opens in a new tab. All three integrations are built on the same script as the [buy button for any website](/selling/embed-buy-button), so the same events (`pocketsflow:success`, `pocketsflow:close`) and the same Apple Pay / Google Pay rules apply. ## Any other site Squarespace, Carrd, Ghost, Wix or your own HTML: use the [Webflow embed code](/integrations/webflow). It works anywhere a page accepts HTML. # Webflow Source: https://docs.pocketsflow.com/integrations/webflow Sell from Webflow with a copy-paste Code Embed: a buy button, link or product card that opens your Pocketsflow checkout. Webflow takes Pocketsflow through a **Code Embed** element. The dashboard writes the code for you: pick a product and a style, copy, paste. ## Add a product **1. Copy the embed code** In the dashboard, open **Integrations → Site builders**, pick a product and a style (button, link or card), choose **Webflow** and click **Copy**. **2. Add a Code Embed** In the Webflow Designer, open the **Add** panel and drag a **Code Embed** element where the button should go. **3. Paste and publish** Paste the code, click **Save & Close**, then publish your site. > [!NOTE] > > The Webflow Designer canvas does not run scripts, so the button shows unstyled > there. It works on the published site. ## What the code looks like A button: ```html theme={"system"} Buy now ``` Add `data-pocketsflow-open="tab"` (the dashboard does it when you choose **New tab**) to open the checkout in a new tab instead of the overlay. The **Card** style wraps the same button in a small card with the product's cover, name and price, written with inline styles so your site's CSS cannot change it. To place several buttons on one page, the ` Buy now Get the guide ``` The `href` is your normal checkout link (the one you get from **Share**). Use `?subscriptionId=…` for a subscription. Any extra query parameters you already use (such as `customerEmail`, `clientReferenceId` or your own metadata) are kept. Without the script, or if it fails to load, the link still works: it simply opens the checkout page. ## Attributes | Attribute | On | What it does | | - | - | - | | `data-pocketsflow-checkout` | any link or element | Opens its `href` in the overlay. The element keeps your site's styling. | | `data-pocketsflow-button` | any link or element | Same, and styles it as a Pocketsflow button (brand blue, 40px tall). | | `data-pocketsflow-open="tab"` | a tagged element | Opens the checkout in a new tab instead of the overlay. Button styling is kept. | Either attribute may carry the checkout URL as its value (`data-pocketsflow-checkout="https://…"`) when the element is not a link, for example a `