Test version. Sandbox only: no real orders are printed, shipped or charged.

Docs

Connect your agent to Madely

Madely fulfills print-on-demand orders for AI agents. Your agent finds a product, gets an exact whole-dollar quote, pays, and places the order. Every step is an API call. No signup, no human step.

This is the test version. Orders here are sandbox orders: nothing is printed or shipped, and payments run in test mode, so no real money moves. Order records live in memory and can reset when the server restarts, so treat order ids as short-lived.

1. Connect your agent

Pick whichever your agent speaks. All three are public and need no account.

WayWhereUse it when
Read the guide/llms.txt and /llms-full.txtYour agent can browse. These plain-text files list every step, example and error code.
OpenAPI/openapi.jsonYour agent builds tools from an OpenAPI 3.1 spec.
MCP server/mcp (HTTP POST, JSON-RPC)Your agent speaks the Model Context Protocol. Descriptor: /.well-known/mcp.json. Tools: list_products, get_product, get_print_spec, validate_print_file, get_quote, create_order, get_order, submit_order, cancel_order and more.

Quick MCP check from any terminal:

curl -s /mcp -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

2. The order flow

  1. GET /v1/products?q=mug finds products. Use the product_id in the next steps. Prices are whole dollars.
  2. POST /v1/quotes returns an exact, repeatable quote: items, shipping at carrier cost, total and estimated ship date. The same input always returns the same quote.
  3. POST /v1/sandbox/keys gives a free test API key. No signup.
  4. Set up payment (see below), then POST /v1/orders with the key, an Idempotency-Key header, the quote_id, artwork URLs, ship-to and "submit": true. The order is charged at submit, before production.
  5. GET /v1/orders/{order_id} tracks it. POST /v1/orders/{order_id}/cancel cancels and refunds before it ships.

Every product has a machine-readable print spec. It is the source of truth: the PNG, SVG and PDF templates and the product pages are generated from it. Agents should read the JSON, not the pages.

WhatWhere
One productGET /v1/products/{id}/print-spec: canvas_px, inches, dpi, bleed, safe_zone, print_zones (wrap and curvature for mugs), color_mode, accepted_formats, max_file_mb, background, orientation, generation_hint, template_urls
All products/print-specs.json and the JSON Schema
Check a filePOST /v1/print-spec/validate (MCP: validate_print_file) with a url and/or width_px, height_px, format, has_transparency. Returns pass/warn/fail per check with a fix, plus an optional placement preview.
Templates for humans/templates/{id}.png, .svg, .pdf

Each spec says where its numbers come from: measured (read from a template file or equal to our production size), Madely product specs, or industry standard, to verify. The last two are not yet confirmed.

curl -s /v1/print-spec/validate -H 'content-type: application/json' \
  -d '{"product_id":"K04","width_px":2550,"height_px":1155,"format":"png","has_transparency":false,"preview":true}'

3. How an agent pays (Stripe)

MethodHow
Agent payment tokenYour agent grants a Stripe Shared Payment Token to Madely's Stripe profile profile_test_61VrkB0XwlLf0T0sIA6VrkB079SQUMsvBMOZN85NAT2u and sends {"payment":{"method":"agent_token","shared_payment_token":"spt_..."}}. No card data reaches Madely. Details: /v1/payments.
Card on filePOST /v1/payment-methods once, then {"payment":{"method":"card_on_file"}}. In test mode use pm_card_visa.
Prepaid balancePOST /v1/balance/top-ups, then {"payment":{"method":"balance"}}.

Set max_cost_usd on every order: Madely refuses to charge more than that ceiling. Retries with the same Idempotency-Key never charge twice.

4. Sample quote and order

Request: POST /v1/quotes

{"items":[{"product_id":"A29","quantity":2},{"product_id":"K04","quantity":1}],
 "ship_to":{"country":"US","zip":"85001"}}

Response (real output, shortened):

{
  "quote_id": "q_e77c29aee61a",
  "price_version": "pv_1bebcad207c0",
  "currency": "USD",
  "lines": [
    {
      "product_id": "A29",
      "sku": "A29-ASPHALT-2XL",
      "name": "Bella Canvas Unisex Tee 3001 (DTF)",
      "quantity": 2,
      "blank_cost_usd": 4.09,
      "flat_fee_usd": 6.91,
      "unit_price_usd": 11,
      "standard_unit_price_usd": 11,
      "line_total_usd": 22
    },
    {
      "product_id": "K04",
      "sku": "K04",
      "name": "Mug 11oz",
      "quantity": 1,
      "blank_cost_usd": 1.12,
      "flat_fee_usd": 3.88,
      "unit_price_usd": 5,
      "standard_unit_price_usd": 5,
      "line_total_usd": 5
    }
  ],
  "items_usd": 27,
  "items_all_whole_dollars": true,
  "tier_applied": {
    "tier_id": "standard",
    "status": "draft_proposal_not_approved",
    "committed_monthly_items": 0,
    "saved_usd": 0
  },
  "shipping": {
    "amount_usd": 5,
    "basis": "carrier cost passed through",
    "source": "mock_flat_estimate",
    "note": "v0 uses a flat $5 mock estimate (whole dollars); real carrier rates replace it before launch."
  },
  "total_usd": 32,
  "items_count": 3,
  "estimated_ship_date": "2026-12-04",
  "ship_date_basis": "2 business days production (assumption, not yet measured)",
  "ship_to": {
    "country": "US",
    "zip": "85001"
  },
  "created_at": "2026-12-02T23:19:38.816Z",
  "expires_at": "2026-12-03T23:19:38.816Z"
}

Placing the order: POST /v1/orders with Authorization: Bearer <sandbox key> and Idempotency-Key: madely-smoketest-001. In test mode external_id must start with madely-smoketest-.

{
  "order_id": "ord_test_rs9b8d",
  "mode": "test",
  "external_id": "madely-smoketest-docs-1",
  "status": "in_production",
  "quote_id": "q_e77c29aee61a",
  "price_version": "pv_1bebcad207c0",
  "currency": "USD",
  "items_usd": 27,
  "shipping_usd": 5,
  "total_usd": 32,
  "tier_applied": "standard",
  "ship_to": {
    "name": "Jordan Lee",
    "address1": "123 Example St",
    "city": "Phoenix",
    "state": "AZ",
    "zip": "85001",
    "country": "US"
  },
  "estimated_ship_date": "2026-12-04",
  "payment": {
    "method": "card_on_file",
    "status": "succeeded",
    "amount_usd": 32,
    "currency": "USD",
    "payment_intent_id": "pi_3Example...",
    "payment_method": {
      "brand": "visa",
      "last4": "4242"
    },
    "livemode": false
  },
  "tracking": null,
  "created_at": "2026-12-02T23:19:38.829Z"
}
// "lines" (items with print-file checks) and "events" omitted here for length

5. Try it: run a sandbox order

These buttons call this server's live API from your browser, in test mode.

Get a quote

Place a test order, end to end

Mints a sandbox key, saves a Stripe test card (pm_card_visa), quotes, places and pays the order, then reads it back. Nothing is shipped.

Results appear here.

Errors

Every error is JSON with a stable code, a plain message, a fix telling the agent what to do next, and a retryable flag. All codes: /llms-full.txt.

{"error":{"code":"max_cost_exceeded","message":"...","fix":"Raise max_cost_usd or reduce items.","retryable":false}}

Test-version limits