# Patchwork > Patchwork A/B tests sections of a website: an agent picks a section by CSS selector, supplies variants (or has Patchwork write them), sets a goal and launches. Patchwork serves the variants from its edge, counts visitors and conversions, and reports which variant wins. Agents can sign up, configure, pay and read results with no human in the loop. ## Connect - MCP server (Streamable HTTP): https://patchwork.run/mcp — call the `signup` tool, then reconnect with `Authorization: Bearer `. - REST API: https://patchwork.run/api/v1 — OpenAPI at https://patchwork.run/openapi.json - Guide: https://patchwork.run/docs/agents ## Flow 1. POST /api/v1/signup {email, website} → api_key, site, snippet. The email's owner gets a link to claim the workspace. 2. Put the snippet in the of every page, then POST /api/v1/sites/{site_id}/install-check. 3. POST /api/v1/sites/{site_id}/experiments {name, page_url, selector} → experiment with the section's original_html. 4. POST /api/v1/experiments/{id}/variants {variants:[{label, html, css?}]}, or POST /generate to have Patchwork write them. 5. PUT /api/v1/experiments/{id}/goal {type:"section_click"}, then POST /launch. 6. GET /api/v1/experiments/{id}/results until recommendation is "ship" or "stop", then POST /ship. ## Pricing and payment One plan: $100 per 30 days, 14-day free trial, no card needed to start. GET /api/v1/billing lists the ways to pay that are on: - Machine Payments Protocol: POST /api/v1/workspaces/{workspace_id}/pay answers 402; pay with any MPP client (card or stablecoin). - Stripe CLI: `stripe pay @ 100 usd`, then POST /api/v1/billing/stripe-pay {transfer_id}. - A Stripe Checkout link for a human: POST /api/v1/billing/checkout. ## Endpoints - POST /api/v1/signup: Create a workspace for a website. Returns an API key (shown once) and the snippet. The owner is emailed a claim link. (no key) - GET /api/v1/me: Workspace, role, billing state, limits and usage. - POST /api/v1/claim: Email the owner a fresh link to claim the workspace in the dashboard. - GET /api/v1/sites: List sites, each with its snippet and install state. - POST /api/v1/sites: Add a site. - GET /api/v1/sites/{site_id}: Get a site. - POST /api/v1/sites/{site_id}/install-check: Fetch the site and report whether the snippet is installed correctly, with fixes. - GET /api/v1/sites/{site_id}/experiments: List a site's experiments. - POST /api/v1/sites/{site_id}/experiments: Start a draft experiment on one section of a page, chosen by CSS selector (must match exactly one element). - GET /api/v1/experiments/{experiment_id}: Status, variants, goal and the original section HTML. - POST /api/v1/experiments/{experiment_id}/variants: Add up to 5 variants you wrote: HTML that replaces the section, plus optional CSS. Sanitized, then approved. - POST /api/v1/experiments/{experiment_id}/generate: Have Patchwork's AI write variants (about a minute). They arrive as pending_review. - POST /api/v1/experiments/{experiment_id}/variants/{variant_id}/approve: Approve a variant for testing. - POST /api/v1/experiments/{experiment_id}/variants/{variant_id}/reject: Reject a variant. - PUT /api/v1/experiments/{experiment_id}/goal: Set the conversion goal. - POST /api/v1/experiments/{experiment_id}/launch: Start serving variants. Needs an approved variant, a goal and an active trial or payment. - POST /api/v1/experiments/{experiment_id}/pause: Stop serving variants. - POST /api/v1/experiments/{experiment_id}/resume: Serve variants again. - POST /api/v1/experiments/{experiment_id}/conclude: End the test. - POST /api/v1/experiments/{experiment_id}/ship: Serve one variant to everyone. - GET /api/v1/experiments/{experiment_id}/results: Visitors, conversions and win probabilities per variant, with a recommendation. - GET /api/v1/keys: List active API keys (owners). - POST /api/v1/keys: Create an API key; returned once (owners). - DELETE /api/v1/keys/{key_id}: Revoke a key (owners). - GET /api/v1/billing: Trial or paid status and every way to pay that is switched on. - POST /api/v1/billing/checkout: A Stripe Checkout link for a person to subscribe with a card. - POST /api/v1/billing/stripe-pay: Redeem a `stripe pay @handle 100 usd` transfer. $100 buys 30 days, pro rata. - POST /api/v1/workspaces/{workspace_id}/pay: Machine Payments Protocol: answers 402 with a challenge; pay it with an MPP client to buy 30 days for $100. No API key. (no key) ## Limits 120 requests a minute per key. 5 signups a day per network, 3 per email. Up to 5 variants per experiment, 100 KB each. Variant HTML is sanitized: no scripts, event handlers or off-site links you didn't include.