Black Friday / Cyber Monday:30% off yearly plans, up to 15% off monthly.Ends Monday, Nov 30 at 11:59 pm ETSee the prices

Developers

Connect your website

The TFM Manufacturing API lets your website show live stock status, send in orders, and read order status and tracking. It's a JSON REST API over HTTPS, included in Ultra and Custom and an add-on on Growth. Webhooks (Custom plan) tell your site when stock or orders change. It's for makers who also sell on their own website; if you only make for stores, dealers or wholesale buyers, you don't need it: enter those orders in the app.

New to the API? Follow the step-by-step guide to connecting your website: create a key, show stock status, send orders in and show tracking, with code to copy. This page is the full reference.

Overview

ParameterTypeDescription
Base URLhttps://twelfthfretmfg.com/api/v1
FormatJSON requests and responses, UTF-8. Money is in decimal currency units (e.g. 189.00). Times are ISO 8601 in UTC.
VersioningThe version is in the path (/v1). Breaking changes only ever ship as a new version; new fields can be added to v1 at any time, so ignore fields you don't recognise.
Request IDsEvery response has an X-Request-Id header. Include it when you contact support.

Authentication

Create an API key in Settings → Integrations → API keys (owners and admins). Choose only the scopes the key needs. The key is shown once; we store only a hash of it, so keep it somewhere safe. Send it as a bearer token:

curl https://twelfthfretmfg.com/api/v1/ping \
  -H "Authorization: Bearer tfm_your_key_here"
ParameterTypeDescription
products:readscopeList products and variants.
inventory:readscopeRead stock status for SKUs or variants.
orders:readscopeRead orders, their status and shipments.
orders:writescopeCreate orders.
Keep keys on your server. A key with orders:write must never appear in browser code. GET requests are allowed from browsers (CORS) so a read-only key (products:read, inventory:read) can be used client-side if you accept that anyone can read your stock levels; POST requests are only accepted from servers.

Errors

Errors use standard HTTP status codes and always have the same shape:

{
  "error": {
    "code": "invalid_request",
    "message": "items must be a list of 1 to 500 lines.",
    "request_id": "req_6pV0..."
  }
}
ParameterTypeDescription
400 invalid_requestSomething in the request is missing or wrong. The message says what.
401 invalid_api_keyMissing, invalid, revoked or expired key.
402 subscription_inactiveThe workspace's subscription isn't active.
403 insufficient_scopeThe key doesn't have the scope this endpoint needs.
403 api_not_in_planThe workspace's plan doesn't include the API (Ultra, Custom, or Growth with the API add-on).
404 not_foundNo such endpoint or record (in your workspace).
409 idempotency_in_progressA request with the same Idempotency-Key is still running.
422 idempotency_mismatchThe Idempotency-Key was used with a different body.
429 rate_limitedToo many requests this minute. Wait for the Retry-After seconds.
429 quota_exceededThe workspace has used this month's API allowance. Retry-After counts down to the 1st (UTC).
500 internal_errorOur fault. Safe to retry with the same Idempotency-Key.

Rate limits

Each key can make 600 requests a minute on Growth and 1,200 on Ultra and Custom. Each workspace also has a monthly allowance: 25,000 requests on Growth with the API add-on, 100,000 on Ultra, agreed on Custom (every authenticated request counts; calendar month, UTC). Over it, requests get 429 quota_exceeded until the 1st, and the owners are emailed at 80% and 100%. Every response includes:

ParameterTypeDescription
X-RateLimit-LimitintegerRequests allowed per minute.
X-RateLimit-RemainingintegerRequests left in the current minute.
X-RateLimit-Resetunix timeWhen the window resets.
X-Quota-LimitintegerRequests included this month (absent when there's no cap).
X-Quota-RemainingintegerRequests left this month.

Tip: cache stock status for a minute or two rather than calling the API on every page view. It keeps your site fast and well inside the monthly allowance.

Pagination

List endpoints return { data, has_more, next_cursor }. Pass next_cursor back (as starting_after for products, created_before for orders) to get the next page. limit is 1–100, default 50.

Idempotency

Networks fail. To retry an order safely, send an Idempotency-Key header (any unique string, e.g. a UUID, up to 255 characters). Retrying with the same key and body returns the original response instead of creating a second order. Keys are kept for 24 hours. Orders with the same external_id are also never created twice.

Stock status

ParameterTypeDescription
in_stockReady to ship. available is the number of units free to sell (null for items not stock-tracked).
made_to_orderNone on the shelf, but it can be ordered; lead_time says how long (e.g. "4-6 weeks").
out_of_stockNone on the shelf and no lead time set: don't take orders for it.

List products

GET/v1/products

Scope products:read. Active products that are set to show on the website, and their variants, with price and stock status. "Show on website" is a listing filter, not privacy: inventory lookups by SKU and inventory.updated webhooks still include hidden products, so check published if your site builds its catalog from those. image_url is the main photo, images the gallery in order, and option_images lists photos to show only when an option value is chosen.

Each variant's lead_time is set only when it's out of stock; made_to_order_lead_time is the variant's (or product's) lead time whenever one is set, so your site can take orders beyond what's on the shelf and say how long the rest takes.

Shop fields, set under Website shop on each product; every one is optional and null when not set. Options, choices, titles and descriptions are keyed by the option names in variant attributes.

ParameterTypeDescription
option_orderstring[]Order of the option pickers (variant attributes come back in storage order).
sort_orderintegerOrder on your shop page, lowest first.
max_per_orderintegerMost a customer can buy at once (1–10,000).
deposit_type, deposit_valuestring, numberpercent (0–100) or fixed (an amount), charged at checkout instead of the full price. Both set or both null.
external_urlstringhttps link to buy the product elsewhere.
choicesarray[{ "name": "Color", "values": ["Navy", "Red"] }]: picks that don't change price or stock.
option_titlesobject{ option: { value: title } }: product title to show when that value is picked.
option_descriptionsobject{ option: { value: text } }: description to show when that value is picked. May contain HTML.
Treat every text field as untrusted. Names, descriptions, titles, choices and option descriptions come back as your team typed them (trimmed). Escape them before putting them on a page, or sanitize the HTML if you show option_descriptions as HTML. max_per_order and the deposit are for your site to apply: work them out in your checkout on your server; POST /v1/orders doesn't enforce them.
ParameterTypeDescription
limitinteger1–100, default 50.
starting_afterproduct idCursor from the previous page.
include_inactivebooleanInclude inactive products and variants, and products hidden from the website (see active and published).
{
  "data": [{
    "id": "8f0c…", "name": "Koa Guitar Stand", "category": "Stands", "active": true, "published": true,
    "description": "Solid koa, felt-lined cradle.", "unit": "ea",
    "image_url": "https://…/products/1.webp", "images": ["https://…/products/1.webp", "https://…/products/2.webp"],
    "option_images": { "wood": { "Walnut": ["https://…/products/2.webp"] } },
    "track_inventory": true, "lead_time": "2-3 weeks",
    "option_order": ["wood"], "sort_order": 1, "max_per_order": 4,
    "deposit_type": null, "deposit_value": null, "external_url": null,
    "choices": [{ "name": "Felt", "values": ["Black", "Red"] }],
    "option_titles": { "wood": { "Walnut": "Walnut Guitar Stand" } }, "option_descriptions": null,
    "variants": [{
      "id": "c1a2…", "sku": "KOA-WAL", "attributes": { "wood": "Walnut" },
      "price": 189.00, "available": 7, "stock_status": "in_stock", "lead_time": null, "made_to_order_lead_time": "2-3 weeks"
    }]
  }],
  "has_more": false,
  "next_cursor": null
}

Check inventory

GET/v1/inventory?sku=KOA-WAL,PANEL-2X4

Scope inventory:read. Stock status for up to 200 SKUs (case-insensitive) or variant_ids.

const res = await fetch('https://twelfthfretmfg.com/api/v1/inventory?sku=KOA-WAL', {
  headers: { Authorization: `Bearer ${process.env.TFM_API_KEY}` },
});
const { data } = await res.json();
const label = data[0].stock_status === 'in_stock' ? 'In stock'
  : data[0].stock_status === 'made_to_order' ? `Made to order: ${data[0].lead_time}`
  : 'Out of stock';

Create an order

POST/v1/orders

Scope orders:write. Send it when a customer checks out. Units on the shelf are reserved straight away; the rest goes onto the build list, and the order's status follows automatically. Returns 201 (or 200 with the existing order if this external_id was already sent).

ParameterTypeDescription
external_idstringYour order number. Recommended: makes the request safe to repeat.
items[]array, required1–500 lines: { sku | variant_id, quantity, unit_price? }. unit_price defaults to the variant's price. A line with only name, unit_price and quantity is a custom item.
customerobject{ name, email }. Removed 30 days after the order is done (see below).
shipping_addressobjectAny address fields you use (stored as given). Removed 30 days after the order is done.
shipping, taxnumberAmounts charged.
paymentobject{ amount, method, reference }: what the customer paid at checkout (e.g. a deposit).
currencystring3-letter code; defaults to the workspace's currency.
metadataobjectUp to 8 KB of your own data, returned with the order.

Your website keeps the customer record. We keep customer and shipping_address only while your team works on the order: 30 days after it is shipped, delivered, cancelled or refunded (with nothing still owed) they are deleted, and the order then returns customer_name and customer_email as null, with customer_details_cleared_at set. A refund recorded after that goes to QuickBooks as "Website customer". Everything else stays, including external_id, so keep your own copy of the customer's details and look orders up by your order number. Don't put customer details in notes or metadata: those are kept.

curl -X POST https://twelfthfretmfg.com/api/v1/orders \
  -H "Authorization: Bearer $TFM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 5f1c2e9a-website-order-10457" \
  -d '{
    "external_id": "10457",
    "customer": { "name": "Sam Rivera", "email": "sam@example.com" },
    "items": [ { "sku": "KOA-WAL", "quantity": 1 }, { "sku": "PANEL-2X4", "quantity": 2 } ],
    "shipping": 25, "tax": 31.40,
    "payment": { "amount": 434.40, "method": "Stripe", "reference": "pi_3Q…" }
  }'

Retrieve an order

GET/v1/orders/{id}

GET/v1/orders/by-external-id/{external_id}

Scope orders:read. Status, items (with ready, shipped and refunded counts) and shipments with carrier and tracking.

ParameterTypeDescription
statusawaiting_build, in_production, preparing_shipment, partially_shipped, shipped, delivered, cancelled, refunded
ready_to_shipbooleanTrue when at least one unit is built and waiting to ship.
shipments[]array{ carrier, tracking_number, shipped_at, items[] }. tracking_number is null when carrier is Local pickup, Delivered by us or Installed

List orders

GET/v1/orders

ParameterTypeDescription
limitinteger1–100, default 50.
created_beforedate-timeCursor from the previous page (newest first).
statusstringOnly orders with this status.
updated_sincedate-timeOnly orders changed since then. Handy for syncing.
customer_emailstringOnly this customer's orders (any case): the order's email, or its saved customer's. For a customer portal, only pass an email the customer has proved is theirs.
sourcestringmanual (entered in TFM Manufacturing) or api (sent by your website).
kindstringorder (sales order) or work_order.

Record a payment

POST/v1/orders/{id}/payments

Scope orders:write. Server only. Records what a customer paid on an order, for example a balance they paid on your website. Same rules as recording a payment in the app: not on a cancelled or refunded order, and never more than what's still due (the error says how much is). Sending the same reference again returns the order unchanged (200) instead of recording it twice, so it's safe to retry; a new payment returns 201 with the updated order. If you use QuickBooks, the payment goes there like any other: money paid before the order is delivered is held as unearned revenue until its invoice. An order's deposit_due is the deposit you asked for on the sales order (or null): to let a customer pay just that, charge deposit_due minus amount_paid.

ParameterTypeDescription
amountnumber, requiredWhat was paid, more than 0.
methodstring, requiredHow, e.g. Stripe. Decides the QuickBooks deposit account: "cash", "bank" or "check" in the name use those; anything else counts as a card payment.
referencestringYour payment id, e.g. the Stripe checkout session. Recommended: makes the request safe to repeat.
paid_atdate-timeWhen it was paid. Defaults to now.
curl -X POST https://twelfthfretmfg.com/api/v1/orders/a41f…/payments \
  -H "Authorization: Bearer tfm_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 450, "method": "Stripe", "reference": "cs_live_…" }'

Webhooks

Custom plan. Add an HTTPS endpoint in Settings → Integrations → Webhooks and choose events. We POST JSON to it and retry with backoff for about a day if your endpoint doesn't answer with a 2xx within 10 seconds; an endpoint that fails 50 times in a row is switched off (you'll see it in the app).

ParameterTypeDescription
inventory.updatedA variant's available quantity, lead time or active flag changed.
order.createdAn order was created (API or manual).
order.status_changedAn order's status changed.
order.shippedA shipment was sent or handed over, with carrier, tracking (null if handed over) and items.
order.refundedAn order was fully refunded.
POST https://your-site.com/webhooks/tfm
TFM-Event-Id: 1c9e…
TFM-Event-Type: order.shipped
TFM-Signature: t=1792300000,v1=5f2b…

{
  "id": "1c9e…",
  "type": "order.shipped",
  "created": 1792300000,
  "data": {
    "id": "a41f…", "order_number": 1043, "external_id": "10457", "status": "partially_shipped",
    "shipment": { "carrier": "UPS", "tracking_number": "1Z999…", "items": [ { "sku": "KOA-WAL", "quantity": 1 } ] }
  }
}

Events can arrive more than once or out of order: use id to skip duplicates and fetch the order if you need its latest state.

Verifying signatures

Every webhook is signed with your endpoint's secret (shown once when you create it). Check the signature on the raw request body before trusting it, and reject old timestamps to stop replays:

import crypto from 'node:crypto';

export function verifyTfmWebhook(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest();
  const given = Buffer.from(parts.v1 || '', 'hex');
  return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}

Setting it up for the first time? Read the step-by-step guide. Questions or need another endpoint? Contact us.