Documentation
API reference
Every endpoint, parameter, field and response.
FlowFinds is two HTTP surfaces. The sourcing engine serves everything under /api/… — finding a product, holding it, pricing it, building the store and running what happens after the sale. The product surface serves the conversational routes: the commerce assistant, generated pages, the walkthrough and sign-in. Both are documented here, from their handlers.
This reference is generated from a single typed array. Each page below is one entry in lib/api-spec.ts, so the reference cannot describe an endpoint the spec does not hold, and an endpoint added to the spec appears here without anybody writing a page.
Authentication in one paragraph
There is no API key. The engine identifies a caller by an ff_session cookie: if the request carries one it is used, and if it does not, the handler mints a fresh identifier, serves the request under it, and returns it in Set-Cookie. Every session-scoped resolver then filters on that value, which is why a client is, in practice, a cookie jar. Read the authentication guide for the full treatment.
# The first call mints a session. Keep the cookie jar for every call after it.
curl -s -c cookies.txt -b cookies.txt "$FLOWFINDS_ORIGIN/api/find"
# The same jar now carries ff_session, so the hold and the claim resolve.
curl -s -c cookies.txt -b cookies.txt "$FLOWFINDS_ORIGIN/api/offer"Reading a response
One authentication scheme, and it is a cookie
The engine identifies a caller by an `ff_session` cookie. `_session()` reads it from the request; if there is none it mints a UUID hex string, uses it for the request, and returns it in `Set-Cookie`. Every session-scoped resolver then filters on that value. There is no API key or bearer token in the handlers, so a client is a cookie jar.
Non-200 means 'no API here'
The engine treats a non-200 answer as a signal that no API is mounted at the path, and the product surface reads it that way. Consequently many refusals are returned as HTTP 200 with a `status` of `refused`, `abstained`, `not_claimed` or similar, plus a `reason` and a human-readable `explanation`. Branch on `status`, not only on the HTTP code.
Every route fails as JSON
`do_GET` and `do_POST` both delegate through `_guarded`, which converts an uncaught exception in any handler into a structured JSON error rather than the stdlib HTML 500 page.
Refusal reasons are a closed set
`GET /api/reasons` serves the whole `REASONS` table the engine can cite, and `GET /api/controls` serves the `CONTROLS` table naming the method and path behind each control. A client can enumerate both rather than hardcoding strings.
Query strings never fall through
`_do_GET_inner` splits the path on `?` before dispatching, so cache busters and UTM parameters cannot push a request into the static file handler and 404.
The consequence for a client is concrete: check status in the body before you check the HTTP code. A great many of the engine’s refusals are successful HTTP responses that say, in a named field, why they could not do what was asked. Errors covers the codes; GET /api/reasons serves the closed set of reason strings.
Discovery
Being shown a product, holding it, passing on it and claiming it. The exclusivity contract lives here.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/find | session | Serve this session's product, minting a hold if it does not have one. |
GET /api/feed | session | Serve the whole field: this session's find first, then what it beat. |
POST /api/select | session | Move this session's hold onto a named product from the field. |
POST /api/pass | session | Claim the held product, or pass on it and be shown the next one. |
POST /api/analyze | session | Run the analyser over any product description, claimed or not. |
GET /api/analysis | session | The analysis of the product this session holds. |
POST /api/ask | session | Ask a question against one or more catalog products. |
POST /api/discover | session | Run the discovery script and return its terminal output verbatim. |
GET /api/discovery-research | session | Read the state of the external discovery research job. |
POST /api/discovery-research | session | Start an external discovery research run. |
GET /api/research-workspace | session | Read the research workspace for the signed-in account. |
POST /api/research-workspace | session | Mutate the research workspace. |
GET /api/reasons | public | Every refusal reason the engine can cite. |
GET /api/controls | public | Every control the product exposes, with the method and path behind it. |
GET /api/track-record | public | The published hit rate, wins and misses, with its own basis stated. |
GET /api/brief | public | The nightly research brief, or the fact that it has never run here. |
GET /api/model | session | The model behind the session's product. |
GET /api/curriculum | session | Curriculum material for a named subject. |
GET /api/notify_me | session | Read the watches this session has placed. |
POST /api/notify_me | session | Watch a product that is currently unavailable. |
Offer and dashboard
The researched price for a held product, the facts a dashboard renders, and the verdict computed over them.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/offer | session | The researched offer for the session's product, or the refusal that says why there is none. |
GET /api/dashboard | session | The verdict, the facts behind it, and where each figure came from. |
GET /api/launch | session | The launch facts, each with whether it is true today. |
POST /api/outcome | session | Declare what happened with a claimed product. |
POST /api/product | session | Publish a product of the founder's own into the store engine. |
POST /api/product-launch | session | Drive the launch state machine for a product. |
POST /api/presence | session | Record which screen the operator is on. |
Store and intents
Generating a storefront, editing it through guided intents, and the domain and checkout paths attached to it.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/store | session | The state of the session's storefront. |
POST /api/store | session | Start generating the storefront for the session's product. |
POST /api/store/publish | session | Verify and publish the storefront, regenerating it if verification demands. |
POST /api/intent | session | Ask the engine what it would change on a surface, and why. |
POST /api/intent/apply | session | Apply a proposed intent, regenerating the store. |
POST /api/intent/order | session | Override the section the storefront leads with. |
POST /api/intent/revert | session | Undo the last applied intent. |
POST /api/ai/edit | session | Edit the storefront in natural language. |
GET /api/editor/ | session | Read editor state and store metrics. |
POST /api/editor/publish | session | Publish the editor's draft. |
GET /api/domains | session | Domain suggestions or a quote for a named domain. |
POST /api/domains/checkout | session | Start payment for a domain. |
POST /api/store/checkout | session | Open a customer order against a published store. |
GET /api/store/confirm | public | Confirm an order with the payment provider and credit the revenue. |
POST /api/track | session | Record a storefront funnel event. |
Growth
Ad artifacts, the ad balance ledger, organic research and approval, and the referral link.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/ad | session | The ad artifact for the session's product, with its pass criteria. |
POST /api/ad/edit | session | Override the ad copy, or reset it to the generated version. |
POST /api/growth/edit | session | Edit a growth artifact in natural language. |
GET /api/ads-manager | session | The campaign book. |
POST /api/ads-manager | session | Save the campaign book. |
GET /api/adbalance | session | The advertising balance, its ledger and any pending top-ups. |
POST /api/adbalance | session | Start a balance top-up. |
GET /api/adbalance/confirm | public | Retired. Balance confirmation is no longer client-driven. |
POST /api/organic/research | session | Research an organic campaign for named platforms. |
POST /api/organic/approve | session | Approve a researched campaign for a platform and scope. |
GET /api/organic/log | session | The approval log. |
GET /api/share | session | The referral link, the people it brought, and the milestones they reached. |
POST /api/share | session | Record that the share control was used, unlocking the next find. |
GET /api/usage | session | The tier, what it includes, and how referrals change it. |
Supplier
Sourcing terms, the supplier connection, and sample ordering.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/suppliers | session | Sourcing options for a named product. |
GET /api/supplier-connection | session | Which supplier this account is connected to. |
POST /api/supplier-connection | session | Connect or disconnect a supplier. |
POST /api/samples/checkout | session | Order a physical sample of a product. |
Activity
Orders, revenue, satisfaction sampling, the support desk and the operator's task list.
| Endpoint | Auth | What it does |
|---|---|---|
GET /api/tracking | session | This founder's orders, and nobody else's. |
GET /api/revenue | session | Confirmed revenue, per store and per currency. |
GET /api/satisfaction | session | The satisfaction sample. |
GET /api/helpdesk | session | The support desk: tickets, replies and the agent's state. |
POST /api/helpdesk | session | Act on a support ticket. |
POST /api/support | session | Ask the support agent a question. |
GET /api/todos | session | The operator's task list. |
POST /api/todos | session | Add, complete or delete a task. |
Account and settings
Creating the account a claim is credited to, signing in and out, and the settings the desk reads.
| Endpoint | Auth | What it does |
|---|---|---|
POST /api/account | session | Save the account a claim is credited to. |
POST /api/login/request | public | Request a sign-in link. |
POST /api/logout | session | Sign out. |
GET /api/settings/business | session | The business settings the support desk reads. |
POST /api/settings/business | session | Save the business settings. |
GET /api/settings/payout | session | The payout destination. |
POST /api/settings/payout | session | Save the payout destination. |
POST /api/settings/rules | session | Manage the support desk's keyword rules. |
Fix
The standalone store-repair tool: submit a URL, watch the run, adopt the result.
| Endpoint | Auth | What it does |
|---|---|---|
POST /api/fix | public | Submit a store URL for repair. |
GET /api/fix/mine | optional | The state of a Fix run, or this account's Fix subscriptions. |
POST /api/fix/adopt | session | Attach a Fix run to this session. |
POST /api/fix/event | optional | Record an event or a piece of feedback against a Fix run. |
Assistant and session (product surface)
The Next.js routes on the product surface: the commerce assistant, generated pages, the journey carrier, the walkthrough and magic-link sign-in.
| Endpoint | Auth | What it does |
|---|---|---|
POST /api/intent | session | Ask the commerce assistant, or resolve a navigation intent. |
POST /api/pages | session | Generate a page from an intent. |
POST /api/journey | public | Issue a single-use journey carrier. |
POST /api/journey/[id]/consume | session | Redeem a journey carrier once. |
GET /api/walkthrough | optional | The walkthrough's steps and this user's position in it. |
POST /api/walkthrough/advance | session | Move forward or back a step. |
POST /api/walkthrough/dismiss | session | Dismiss the walkthrough. |
POST /api/auth/request-link | public | Request a magic sign-in link. |
GET /api/auth/callback | callback | Redeem a magic link. |
GET /api/health | public | Liveness, and which build is answering. |
Internal and administrative paths
These exist in the running server and are listed so the surface is accounted for rather than quietly trimmed. They are not part of the developer interface: they are authenticated separately, called by a payment provider, or serve generated HTML rather than JSON. Their shapes follow the console or the provider that calls them, so no contract is documented for them here.
| Endpoint | Auth | What it does |
|---|---|---|
GET /admin | admin | The founder admin console. |
GET /marketing | admin | The marketing lane and its own admin. |
GET /simplepay | callback | Payment-provider callbacks and assets. |
POST /api/billing/webhook | callback | Billing provider webhook. |
GET /store/ | public | Generated HTML: storefronts, previews, profiles and coded links. |
What this reference covers
The extracted surface lists 99 distinct paths across the engine's handler files, many of them repeated across scratch copies of `server.py`. This reference documents the developer-facing paths in full and accounts for the remainder — the admin console, the marketing lane, the payment-provider callbacks and the prefixes that serve generated HTML — as internal entries rather than omitting them.
| Distinct paths extracted from the handlers | 99 |
|---|---|
| Endpoints documented in full | 90 |
| Internal groupings accounted for | 5 |
Next
- Quickstart — from nothing to a first successful call.
- Agents and tools — the tools the commerce agent can call, and the evidence each one returns.
- Cookbook — recipes that compose these endpoints into a working sequence.
90 endpoints are documented above. Start with GET /api/find.
Next: Quickstart · Agents and tools · Cookbook