Docs
Install a torch
A torch is two lines: an element where the cards show, and one script. The script is under 6 KB, loads after your page, sets no cookies and draws the cards in its own Shadow DOM, so it never touches your styles. Every link it renders is marked rel="sponsored noopener".
Before you start
- Sign in, list your product and verify your domain. A torch shows cards only on its verified domain and its
www.form. - In your dashboard, open Torches and add one for the place it goes: footer, sidebar, docs, a 404 page, a thank-you page, inside your app, or your emails. Pick its format and theme with the live preview.
- Copy its snippet. It carries your torch key, which starts with
tk_. Below, replacetk_your_torch_keywith it.
Set up with an AI agent
Swapfire has an MCP server, so a coding agent like Claude Code or Cursor can do the setup for you: list your product, verify your domain, add the torch to your code and book a launch. It works as you, once you approve it.
Claude Code
claude mcp add --transport http swapfire https://swapfire.co/api/mcp.cursor/mcp.json
{
"mcpServers": {
"swapfire": {
"url": "https://swapfire.co/api/mcp"
}
}
}.vscode/mcp.json
{
"servers": {
"swapfire": {
"type": "http",
"url": "https://swapfire.co/api/mcp"
}
}
}Other agents connect to https://swapfire.co/api/mcp over Streamable HTTP and sign in with OAuth.
- The first time your agent calls Swapfire, it opens a page here. Sign in and approve it.
- Ask it, for example: “List example.com on Swapfire, verify the domain and put a torch in the footer.” It shows you what it will publish before it does.
- See and remove the apps you approved in Connections.
list_products: Your products, their status and the next step for each.get_product: One product in full, with the reviewer's note when it was sent back.create_product: Starts a product from its address: Swapfire drafts the listing and three cards.update_listing: Changes a draft's name, tagline, description or card copy.set_camp: Picks its camp and categories.get_verification: The DNS record, meta tag, file or badge that proves the domain is yours.verify_domain: Checks the one you published.submit_for_review: Sends the product to review.create_torch: Adds a torch and gives its code for your framework.book_launch: Books a free launch week (1,500 sparks).get_stats: Views, verified visits, sign-ups and sparks.
Plain HTML
Paste both lines where the cards should show, for example just before your footer's closing tag. Several torches on one page share the one script.
Torch snippet
<div data-swapfire="tk_your_torch_key"></div>
<script async src="https://swapfire.co/w.js"></script>Next.js
With the App Router, make a small client component. It works the same in the Pages Router.
components/torch.tsx
"use client";
import Script from "next/script";
declare global {
interface Window {
swapfire?: () => void;
}
}
// Put <Torch /> where the cards should show. Client-side navigation adds
// new torch elements, so the script is asked to look again on each mount.
export function Torch({ torchKey }: { torchKey: string }) {
return (
<>
<div data-swapfire={torchKey} />
<Script
src="https://swapfire.co/w.js"
strategy="afterInteractive"
onReady={() => window.swapfire?.()}
/>
</>
);
}To confirm verified visits on every page, also load the script once in your root layout. Next.js loads it only once, however many torches the page has.
app/layout.tsx
// app/layout.tsx: the script on every page confirms verified visits,
// even on pages without a torch.
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script src="https://swapfire.co/w.js" strategy="afterInteractive" />
</body>
</html>
);
}WordPress
- Block themes: open Appearance → Editor, edit your Footer template part, and add a Custom HTML block.
- Classic themes: open Appearance → Widgets and add a Custom HTML widget to a footer or sidebar area.
- Paste the torch snippet into the block or widget and save.
Torch snippet
<div data-swapfire="tk_your_torch_key"></div>
<script async src="https://swapfire.co/w.js"></script>Only administrators can save scripts in Custom HTML. On a multisite network, ask the network admin, or add the script line site-wide with a code snippets plugin and keep only the <div> in the block.
Framer
- Open Site Settings → General → Custom Code and paste the script in End of <body> tag.
- On the canvas, insert an Embed where the cards should show, set its type to HTML, and paste the element.
- Publish. Custom code doesn't run in the editor or the canvas preview: check the live site.
Site Settings → End of <body> tag
<script async src="https://swapfire.co/w.js"></script>Embed (HTML)
<div data-swapfire="tk_your_torch_key"></div>Framer allows custom code on paid site plans.
Webflow
- Open Site settings → Custom code and paste the script in Footer code.
- In the Designer, drag a Code Embed element where the cards should show, and paste the element.
- Publish. Custom code runs only on the published site, not in the Designer.
Site settings → Footer code
<script async src="https://swapfire.co/w.js"></script>Code Embed
<div data-swapfire="tk_your_torch_key"></div>Webflow allows custom code on a paid site plan or a paid Workspace.
404 and thank-you pages
A 404 or thank-you torch shows a grid of up to 3 cards under a short title: “Lost? Try these indie tools” on a 404 page, “While you're here: tools by indie makers” after a purchase or a sign-up. Add the torch for that place in your dashboard, then paste its snippet on that page only.
Torch snippet
<div data-swapfire="tk_your_torch_key"></div>
<script async src="https://swapfire.co/w.js"></script>In Next.js, put the Torch component from the guide above in your not-found page.
app/not-found.tsx
// app/not-found.tsx: a grid of 3 cards under your own message.
import { Torch } from "@/components/torch";
export default function NotFound() {
return (
<main>
<h1>Page not found</h1>
<Torch torchKey="tk_your_torch_key" />
</main>
);
}The page must be served from your verified domain like any other: most hosts serve the 404 page there already.
In-app drawer
An in-app torch is a “Made by indies” button that opens a side panel with up to 6 cards. Cards count as seen only while the panel is open. The panel closes with Escape or its close button and gives focus back to what opened it. Paste the snippet where the button should sit, such as your app's menu or settings page.
Torch snippet
<div data-swapfire="tk_your_torch_key"></div>
<script async src="https://swapfire.co/w.js"></script>To open the panel from your own menu item instead, hide the button with data-launcher="none" and call swapfire('open'). The queue line lets the call work before the script has loaded.
Your own button
<div data-swapfire="tk_your_torch_key" data-launcher="none"></div>
<button type="button" onclick="swapfire('open')">Made by indies</button>
<script>
window.swapfire = window.swapfire || function () { (swapfire.q = swapfire.q || []).push(arguments) };
</script>
<script async src="https://swapfire.co/w.js"></script>Your app must run on the product's verified domain or its www. form. Keep the element out of any parent with a CSS transform or filter: the panel would open inside that parent instead of over the page.
Email torch
An email can't run scripts, so an email torch is an image card and a link. Paste the HTML into your newsletter or receipt template, and replace both SEND with a word of your own for each send: the issue number of a newsletter, or the date for receipts. Letters, numbers, dots, dashes and underscores, up to 64.
Email HTML
<a href="https://swapfire.co/m/tk_your_torch_key/SEND" target="_blank" rel="sponsored noopener"><img src="https://swapfire.co/m/tk_your_torch_key/SEND/card.png" width="600" height="200" alt="Promoted: an indie product from the Swapfire network" style="display:block;width:100%;max-width:600px;height:auto;border:0"></a>
<p style="margin:8px 0 0;font:12px/1.4 -apple-system,'Segoe UI',Roboto,sans-serif;color:#5f5a57">Promoted · <a href="https://swapfire.co/m/tk_your_torch_key/SEND/report" target="_blank" rel="sponsored noopener" style="color:#5f5a57;text-decoration:underline">Report</a> · <a href="https://swapfire.co/?ref=tk_your_torch_key" target="_blank" rel="sponsored noopener" style="color:#5f5a57;text-decoration:underline">Your product here → Swapfire</a></p>- The first time a send's image loads, Swapfire picks its card and keeps it: every reader of that send sees the same card, and the link leads to it.
- Opening an email never counts as a view: mail apps load and cache every image. The torch earns when a reader clicks a member's card and the visit is verified (40 sparks), or signs up (400).
- Up to 20 new send words a day per torch. Past that, the image shows Swapfire's own card until the next day (UTC).
Keep the line under the image: it carries the Promoted label, the Report link and the link to Swapfire. A web torch's key doesn't work in an email, and an email torch's key doesn't work on a web page.
Verified visits and sign-ups
When someone clicks your card on another member's site, they land on your site with a one-time visit code. The Swapfire script on your site confirms the visit after 5 visible seconds, so keep the script on every page, even pages without a torch.
Script alone
<script async src="https://swapfire.co/w.js"></script>Right after a sign-up, report it from the page. Swapfire receives only a SHA-256 hash of the email and matches it to a visit of the last 30 days.
After a sign-up
swapfire.track('signup', { email: user.email })If your sign-up code can run before the script has loaded, add this queue first; calls made early are replayed once it loads.
Queue, before the script
<script>
window.swapfire = window.swapfire || function () { (swapfire.q = swapfire.q || []).push(arguments) };
</script>To report sign-ups, refunds and chargebacks from your server instead, use the signed webhook in your product's settings in the dashboard.
The Swapfire badge
A live product is in the directory while its torch is live or the badge is on its site. The badge links to your product's page on Swapfire and counts the visitors the network sent you. Copy yours from your product's page in the dashboard; it carries your product's address on Swapfire in place of your-product.
Badge
<a href="https://swapfire.co/p/your-product?ref=badge"><img src="https://swapfire.co/badge/your-product.svg" alt="Your product on Swapfire" height="56"></a>We look for the link in the HTML your server sends, on the page you name, and check it again every week. Any link to your Swapfire page counts, with rel="nofollow" or rel="sponsored" too. A missing badge is emailed, and the listing is hidden 14 days after it was last seen, until it is back. Without a torch, the badge is also how to get listed free.
Content Security Policy
If your site sends a CSP header, allow Swapfire to load the script and receive views. Card logos and images load over HTTPS, and the torch keeps its styles in an inline style element inside its shadow root, which needs 'unsafe-inline' for styles.
CSP directives to add
script-src 'self' https://swapfire.co;
connect-src 'self' https://swapfire.co;
img-src 'self' https:;
style-src 'self' 'unsafe-inline';Your privacy policy
The torch sets no cookies and keeps nothing in the browser. Your privacy policy should still say it is there: paste this paragraph in. What Swapfire stores, and for how long, is in our privacy policy.
For your privacy policy
This site shows promoted products from Swapfire, a network of independent makers, in a small widget. The widget sets no cookies and stores nothing in your browser. To count each view and click once a day without tracking you, Swapfire turns your IP address and your browser's user agent into a one-way code, mixed with a random value that changes every day and is deleted at the end of that day, so the code can't be traced back to you or linked across days. With that code, Swapfire records your country and which promoted product you saw or clicked; it doesn't keep your IP address. If you arrive here from a promoted card, this site keeps a visit code in this browser tab until you close it, to confirm the visit to Swapfire; if you then sign up, a one-way hash of your email address, never the address itself, may be sent to Swapfire to confirm the sign-up. Swapfire's privacy policy: https://swapfire.co/privacy
Troubleshooting
When a torch can't show cards, it says why in the browser console, after Swapfire torch:.
- origin_mismatch
- The page isn't on the torch's verified domain or its www. form.
- unverified
- The domain isn't verified yet. Verify it from your products page.
- inactive
- The torch is paused, or the product is out of the network.
- wrong_surface
- This key belongs to an email torch. Add a torch for this place in your dashboard.
- not_found or bad_key
- The key in data-swapfire is mistyped. Copy the snippet again.
- origin_required
- The page was opened from a file or a sandboxed frame. Serve it over http(s).
Views count only when half a card is visible for a second on a visible page, once per visitor per card per day. The dashboard's preview never counts views.