Developers
API reference
Read and add to your store's inventory, orders, customers and sales over REST, or connect an AI assistant over MCP. Every request uses a store API key.
- Base URL
- flippant-roadrunner-817.convex.site/api/v1
- Auth
- Bearer rs_… key
- Format
- JSON, money in cents
API reference
Get started
Introduction
The RetroSwap API reads and adds to one store's inventory, orders, customers and sales. It is a REST API under /api/v1 that takes and returns JSON, with standard HTTP status codes and a store API key on every request.
AI assistants such as Claude, Gemini and ChatGPT connect through the MCP server at /mcp instead. It uses the same keys and is read-only.
Each store has its own server address. Copy it from Settings > Store settings > API access; the samples here use a placeholder.
- REST API v1: inventory, orders, customers and sales reports.
- MCP server: seven read-only tools for AI assistants.
- Webhooks: signed POST requests to your own endpoint.
curl https://flippant-roadrunner-817.convex.site/api/v1/stats \
-H "Authorization: Bearer $RETROSWAP_API_KEY"https://flippant-roadrunner-817.convex.site/api/v1Authentication
The store owner creates API keys in Settings > Store settings > API access. A key belongs to one store, starts with rs_, and is shown once when it's made. The key picks the store, so no request takes a store id.
Send the key as Authorization: Bearer rs_... or as X-API-Key: rs_.... Keep it on your server: anyone holding it can read what its permissions allow. Revoke a key on the same tab, and requests with it fail straight away.
API access is on every plan.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/inventory \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-d limit=1Authorization: Bearer rs_your_api_key
X-API-Key: rs_your_api_keyPermissions
Each key carries the permissions chosen when it was created. A route or tool the key isn't allowed returns 403 on REST, or a tool result with isError on MCP. Give each app only what it needs: a price board needs inventory:read, an assistant usually needs the read permissions except customers.
| Permission | What it allows |
|---|---|
| inventory:read | List and get inventory items. MCP: search_inventory, get_inventory_item. |
| inventory:write | Add inventory items with POST /api/v1/inventory. |
| orders:read | List orders. MCP: list_orders, get_order. Shipping addresses and notes only with contact sharing on. |
| orders:write | Can be granted; no route uses it yet. |
| customers:read | List customers. MCP: find_customers. Email, phone and notes only with contact sharing on. |
| customers:write | Can be granted; no route uses it yet. |
| analytics:read | KPIs and quick stats. MCP: get_sales_summary. |
| pricing:read | MCP: get_market_price. |
| pricing:write | Can be granted; no route uses it yet. |
| webhooks:manage | Can be granted; webhooks are managed in the app for now. |
Errors
A 2xx status means the request worked. 4xx means something about the request needs to change, and the body says what in an error field. 5xx means RetroSwap failed; retry with backoff.
| Status | Meaning |
|---|---|
| 200 OK | It worked. |
| 201 Created | The item was added. |
| 400 Bad Request | A required field is missing or a value is out of range. |
| 401 Unauthorized | The key is missing, wrong, revoked or expired, or the store is closed. |
| 403 Forbidden | The key lacks the permission the route needs. |
| 404 Not Found | No such record in this store. |
| 429 Too Many Requests | Over the key's rate limit. Wait for Retry-After seconds. |
| 500 Internal Server Error | Something failed on RetroSwap's side. Retry with backoff. |
{
"error": "Permission denied: orders:read required"
}Rate limits
Each key may make 60 requests a minute unless the owner set a different limit when creating it. REST and MCP requests count against the same limit.
Successful replies carry the limit headers. Over the limit, the API returns 429 with Retry-After in seconds; wait that long before trying again.
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 2026-11-12T19:41:00.000Z
Retry-After: 42 (429 only)Pagination
List routes take limit and offset. limit defaults to 100 and is capped at 500; offset defaults to 0. Lists come newest first. A page shorter than limit is the last one.
Inventory reads a window of the newest 1,000 items: offset plus limit may not exceed 1000. Filter by status or console to reach older stock.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/orders \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-d limit=50 \
-d offset=50Money
RetroSwap stores money as integer cents: 1999 means $19.99. Order totals and line prices are cents, and every MCP tool returns cents in fields ending in Cents.
Inventory prices are the exception on REST: sellPrice, buyPrice and marketPrice are dollars, each with an integer-cent mirror such as sellPriceCents. Use the Cents fields. When adding an item, sellPriceCents wins over sellPrice if you send both.
{
"sellPrice": 19.99,
"sellPriceCents": 1999
}Customer data
Keys see customer names and trade-in totals but not email, phone, addresses or notes. Only the store owner can turn on Share customer contact details, under Customer details on the API access tab, and it applies to every key at once.
With sharing off, those fields are left out of the response rather than sent empty.
Inventory
The inventory item object
One line of stock: a game, console or accessory with its condition, quantity, status and prices.
Attributes
_idstringUnique id of the item.
skustringThe store's SKU, if it has one.
titlestringTitle as shown on the shelf, e.g. Super Mario 64.
consolestringConsole or platform, e.g. N64.
regionstringRegion, e.g. NTSC-U or PAL.
itemTypestringGame, console, accessory and so on.
productCategorystringThe store's category for the item.
conditionstringCondition, e.g. Loose, CIB or New.
hasBoxbooleanWhether the box is included.
hasManualbooleanWhether the manual is included.
quantityintegerUnits on hand.
statusstringWhere the item is, e.g. In Stock, Sold or Trade-In Pending.
sellPricenumberShelf price in dollars.
sellPriceCentsintegerShelf price in cents. Prefer this.
buyPricenumberWhat the store paid, in dollars.
buyPriceCentsintegerWhat the store paid, in cents.
marketPricenumberMarket value in dollars.
marketPriceCentsintegerMarket value in cents.
dateAddedstringDate added, YYYY-MM-DD.
upcstringBarcode, if known.
imageUrlstringPhoto URL, if the item has one.
notesstringStaff notes.
{
"_id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"itemType": "Game",
"productCategory": "Video Games",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPrice": 34.99,
"sellPriceCents": 3499,
"buyPrice": 15,
"buyPriceCents": 1500,
"marketPrice": 32.5,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12",
"upc": "045496870010"
}List inventory items
GET/api/v1/inventory
Permission: inventory:read
Returns the store's inventory, newest first. offset plus limit may not exceed 1000; narrow older stock with status or console.
Query parameters
statusstringOnly items with this status, e.g. In Stock, Sold or Trade-In Pending.
consolestringOnly this exact console, e.g. N64.
limitintegerHow many to return, 1 to 500. Defaults to 100.
offsetintegerHow many to skip first. Defaults to 0.
Returns
An array of inventory item objects.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/inventory \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
--data-urlencode "status=In Stock" \
-d console=N64 \
-d limit=20[
{
"_id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"itemType": "Game",
"productCategory": "Video Games",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPrice": 34.99,
"sellPriceCents": 3499,
"buyPrice": 15,
"buyPriceCents": 1500,
"marketPrice": 32.5,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12",
"upc": "045496870010"
}
]Add an inventory item
POST/api/v1/inventory
Permission: inventory:write
Adds one item to the store's stock with status In Stock. Fields not listed here, including storeId, are ignored: the key decides the store.
The item counts against the plan's item limit; a store at its limit gets 403. Text fields are trimmed, title may be up to 300 characters, notes up to 5000 and other text up to 120. quantity is a whole number up to 100,000, prices are at most $1,000,000 and imageUrl must be an http or https link. A field that breaks a rule gets 400.
Body
titlestringRequiredTitle of the item.
consolestringRequiredConsole or platform.
itemTypestringRequiredGame, console, accessory and so on.
productCategorystringThe store's category.
conditionstringe.g. Loose, CIB or New.
regionstringe.g. NTSC-U or PAL.
sellPriceCentsintegerShelf price in cents.
sellPricenumberShelf price in dollars. Ignored when sellPriceCents is sent.
buyPriceCentsintegerWhat the store paid, in cents.
buyPricenumberWhat the store paid, in dollars. Ignored when buyPriceCents is sent.
quantityintegerUnits on hand.
hasBoxbooleanBox included.
hasManualbooleanManual included.
notesstringStaff notes.
imageUrlstringA photo URL.
skustringThe store's SKU.
upcstringBarcode.
Returns
201 with the new inventory item object. 400 when title, console or itemType is missing.
curl -X POST https://flippant-roadrunner-817.convex.site/api/v1/inventory \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Super Mario 64",
"console": "N64",
"itemType": "Game",
"condition": "Loose",
"sellPriceCents": 3499,
"buyPriceCents": 1500,
"quantity": 1
}'{
"_id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"itemType": "Game",
"productCategory": "Video Games",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPrice": 34.99,
"sellPriceCents": 3499,
"buyPrice": 15,
"buyPriceCents": 1500,
"marketPrice": 32.5,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12",
"upc": "045496870010"
}Get an inventory item
GET/api/v1/inventory/{id}
Permission: inventory:read
Returns one item by its id, with its photo URL when it has one.
Path parameters
idstringRequiredThe item's _id.
Returns
An inventory item object, or 404 if this store has no such item.
curl https://flippant-roadrunner-817.convex.site/api/v1/inventory/j57a8kq2v1x9m3c4d5e6f7g8h9 \
-H "Authorization: Bearer $RETROSWAP_API_KEY"{
"_id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"itemType": "Game",
"productCategory": "Video Games",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPrice": 34.99,
"sellPriceCents": 3499,
"buyPrice": 15,
"buyPriceCents": 1500,
"marketPrice": 32.5,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12",
"upc": "045496870010"
}Orders
The order object
A sale from the storefront or a connected marketplace. All money fields are integer cents.
Attributes
_idstringUnique id of the order.
customerIdstringThe customer, if the order has one.
orderTypestringWhere it came from: pos, online, ebay, shopify or manual.
orderNumberstringThe number customers see.
externalOrderIdstringThe marketplace's own id, for eBay, Shopify or Amazon orders.
statusstringpending, processing, shipped, delivered, cancelled or refunded.
itemsarray of objectsThe lines on the order.
Show child attributesHide child attributes
inventoryIdstringThe inventory item sold.
titlestringTitle at the time of sale.
consolestringConsole at the time of sale.
quantityintegerUnits on this line.
priceintegerPrice per unit, in cents.
conditionstringCondition at the time of sale.
subtotalintegerBefore tax, shipping and discounts, in cents.
taxintegerTax, in cents.
shippingintegerShipping charged, in cents.
discountintegerDiscounts, in cents.
totalintegerWhat the customer paid, in cents.
paymentStatusstringPayment state, e.g. paid or refunded.
paymentMethodstringHow it was paid.
paidAtstringWhen it was paid, ISO 8601.
couponCodestringCoupon used, if any.
trackingNumberstringCarrier tracking number.
carrierstringShipping carrier, e.g. USPS.
shippedAtstringWhen it shipped, ISO 8601.
deliveredAtstringWhen it was delivered, ISO 8601.
createdAtstringWhen it was placed, ISO 8601.
updatedAtstringWhen it last changed, ISO 8601.
shippingAddressobjectShip-to address. Only when the store owner shares customer contact details.
customerNotesstringNotes from the customer. Only when the store owner shares customer contact details.
internalNotesstringStaff notes. Only when the store owner shares customer contact details.
{
"_id": "k17d4m2p9q8r7s6t5u4v3w2x1",
"customerId": "m29c8b7a6z5y4x3w2v1u0t9s8",
"orderType": "online",
"orderNumber": "RS-10482",
"status": "shipped",
"items": [
{
"inventoryId": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"title": "Super Mario 64",
"console": "N64",
"quantity": 1,
"price": 3499,
"condition": "Loose"
}
],
"subtotal": 3499,
"tax": 289,
"shipping": 500,
"discount": 0,
"total": 4288,
"paymentStatus": "paid",
"paymentMethod": "card",
"paidAt": "2026-11-12T16:02:11.000Z",
"trackingNumber": "9400111899223197428490",
"carrier": "USPS",
"shippedAt": "2026-11-12T18:30:00.000Z",
"createdAt": "2026-11-12T16:01:47.000Z",
"updatedAt": "2026-11-12T18:30:00.000Z"
}List orders
GET/api/v1/orders
Permission: orders:read
Returns the store's orders, newest first.
Query parameters
statusstringOnly orders with this status: pending, processing, shipped, delivered, cancelled or refunded.
limitintegerHow many to return, 1 to 500. Defaults to 100.
offsetintegerHow many to skip first. Defaults to 0.
Returns
An array of order objects.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/orders \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-d status=shipped \
-d limit=10[
{
"_id": "k17d4m2p9q8r7s6t5u4v3w2x1",
"customerId": "m29c8b7a6z5y4x3w2v1u0t9s8",
"orderType": "online",
"orderNumber": "RS-10482",
"status": "shipped",
"items": [
{
"inventoryId": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"title": "Super Mario 64",
"console": "N64",
"quantity": 1,
"price": 3499,
"condition": "Loose"
}
],
"subtotal": 3499,
"tax": 289,
"shipping": 500,
"discount": 0,
"total": 4288,
"paymentStatus": "paid",
"paymentMethod": "card",
"paidAt": "2026-11-12T16:02:11.000Z",
"trackingNumber": "9400111899223197428490",
"carrier": "USPS",
"shippedAt": "2026-11-12T18:30:00.000Z",
"createdAt": "2026-11-12T16:01:47.000Z",
"updatedAt": "2026-11-12T18:30:00.000Z"
}
]Customers
The customer object
Someone who has bought from or traded in to the store. Contact fields appear only when the owner shares them.
Attributes
_idstringUnique id of the customer.
namestringThe customer's name.
createdAtstringWhen the record was made, ISO 8601.
isGuestbooleanTrue for a guest checkout without an account.
totalTradeInsintegerHow many trade-ins they've made.
totalValuenumberTotal trade-in value, in dollars.
emailstringEmail address. Only when the store owner shares customer contact details.
phonestringPhone number. Only when the store owner shares customer contact details.
notesstringStaff notes. Only when the store owner shares customer contact details.
{
"_id": "m29c8b7a6z5y4x3w2v1u0t9s8",
"name": "Sam Rivera",
"createdAt": "2026-03-08T14:20:00.000Z",
"isGuest": false,
"totalTradeIns": 6,
"totalValue": 212.5
}List customers
GET/api/v1/customers
Permission: customers:read
Returns the store's customers.
Query parameters
limitintegerHow many to return, 1 to 500. Defaults to 100.
offsetintegerHow many to skip first. Defaults to 0.
Returns
An array of customer objects.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/customers \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-d limit=25[
{
"_id": "m29c8b7a6z5y4x3w2v1u0t9s8",
"name": "Sam Rivera",
"createdAt": "2026-03-08T14:20:00.000Z",
"isGuest": false,
"totalTradeIns": 6,
"totalValue": 212.5
}
]Reports
Get KPIs
GET/api/v1/analytics/kpis
Permission: analytics:read
Revenue, orders, average order value, customers and stock for a period, each with the change from the period before as a percentage.
Units differ by field: revenue, averageOrderValue and profitMargin amounts are cents; inventory values are dollars. cogs is an estimate at 55% of revenue, not the store's real cost of goods.
Query parameters
periodstringtoday, week, month, quarter or year. Defaults to month.
Returns
A KPI object.
curl -G https://flippant-roadrunner-817.convex.site/api/v1/analytics/kpis \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-d period=week{
"revenue": {
"value": 184250,
"change": 12.4,
"previousValue": 163920
},
"orders": {
"value": 41,
"change": 7.9,
"previousValue": 38
},
"averageOrderValue": {
"value": 4494,
"change": 4.2,
"previousValue": 4314
},
"customers": {
"total": 512,
"new": 9,
"change": 28.6
},
"inventory": {
"totalItems": 1240,
"totalValue": 38215.5,
"costBasis": 17240,
"potentialProfit": 20975.5
},
"inventoryTurnover": {
"value": 0.03,
"soldCount": 44
},
"profitMargin": {
"value": 45,
"grossProfit": 82912,
"cogs": 101338
},
"period": {
"start": "2026-11-05",
"end": "2026-11-12",
"label": "week"
}
}Get quick stats
GET/api/v1/stats
Permission: analytics:read or inventory:read
Sales today, this week and this month, stock on hand, aged stock and open work, for a price board or a back-office display. Amounts are dollars.
Returns
A stats object.
curl https://flippant-roadrunner-817.convex.site/api/v1/stats \
-H "Authorization: Bearer $RETROSWAP_API_KEY"{
"timestamp": "2026-11-12T19:41:00.000Z",
"sales": {
"today": {
"count": 7,
"revenue": 214.93
},
"week": {
"count": 44,
"revenue": 1842.5
},
"month": {
"count": 171,
"revenue": 7310.2
}
},
"inventory": {
"totalItems": 1240,
"totalUnits": 1388,
"totalValue": 38215.5,
"lowStockCount": 12,
"aging": {
"count": 86,
"value": 2140
}
},
"operations": {
"pendingOrders": 3,
"pendingTradeIns": 2,
"unreadAlerts": 5
},
"trends": {
"topConsoles": [
{
"console": "N64",
"count": 31
}
]
}
}MCP server
MCP server
POST/mcp
AI assistants connect to RetroSwap through the Model Context Protocol. The server is at /mcp on your store's address and uses the same API keys as the REST API. Every tool is read-only: assistants can look things up and explain them, but adding stock, changing prices, taking payments and paying out trade-ins stay with people in the app.
It speaks MCP over Streamable HTTP, statelessly. Each POST carries one JSON-RPC message or a batch, and the reply is plain JSON. There are no sessions and no server-sent stream, so GET and DELETE return 405.
Supported protocol versions are 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05. A client asking for another version gets 2025-11-25.
A tool's reply carries the data twice: as a JSON string in content[0].text for older clients, and as an object in structuredContent. The samples on this page show structuredContent.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-11-25",
"capabilities": {},
"clientInfo": {
"name": "my-app",
"version": "1.0.0"
}
}
}'{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-11-25",
"capabilities": {
"tools": {
"listChanged": false
}
},
"serverInfo": {
"name": "retroswap",
"title": "RetroSwap",
"version": "1.0.0"
},
"instructions": "RetroSwap runs a retro video game store: …"
}
}Connect an assistant
In Settings > Store settings > API access, Connect an AI assistant makes a key with the right permissions, shows your server address, and gives setup for Claude Code, Gemini CLI, Cursor, VS Code and other MCP apps with the key filled in. Its last step tests the connection.
The Claude and ChatGPT desktop and web apps need a sign-in step (OAuth) that isn't ready yet. Until then, use Claude Code, Gemini CLI, another MCP app, or the OpenAI or xAI API, which accept the same URL and Authorization header as a remote MCP tool.
claude mcp add --transport http retroswap https://your-deployment.convex.site/mcp --header "Authorization: Bearer rs_your_api_key"{
"mcpServers": {
"retroswap": {
"url": "https://your-deployment.convex.site/mcp",
"headers": {
"Authorization": "Bearer rs_your_api_key"
}
}
}
}List tools
POST/mcp
Returns the tools this key may call, each with its input schema. A key without a tool's permission doesn't see that tool. Use it to check a new connection.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "search_inventory",
"title": "Search inventory",
"description": "Find items in the store's inventory by title, console or status. …",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
}
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false
}
}
]
}
}Search inventory
POST/mcp· search_inventory
Permission: inventory:read
Finds items by words from the title, an exact console or an exact status, with price, condition, quantity and status for each. Leave query empty to list the newest items.
Arguments
querystringWords from the title, e.g. zelda.
consolestringExact console name, e.g. N64.
statusstringExact status, e.g. In Stock, Sold or Trade-In Pending.
limitintegerMost results to return, 1 to 50. Defaults to 20.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "search_inventory",
"arguments": {
"query": "mario",
"console": "N64",
"limit": 5
}
}
}'{
"count": 1,
"items": [
{
"id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPriceCents": 3499,
"buyPriceCents": 1500,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12"
}
]
}Get an inventory item
POST/mcp· get_inventory_item
Permission: inventory:read
Gets one item by its id or SKU, including staff notes. Pass one of the two.
Arguments
idstringItem id from search_inventory.
skustringThe item's SKU.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_inventory_item",
"arguments": {
"sku": "N64-SM64-0412"
}
}
}'{
"found": true,
"item": {
"id": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"sku": "N64-SM64-0412",
"title": "Super Mario 64",
"console": "N64",
"region": "NTSC-U",
"condition": "Loose",
"hasBox": false,
"hasManual": false,
"quantity": 1,
"status": "In Stock",
"sellPriceCents": 3499,
"buyPriceCents": 1500,
"marketPriceCents": 3250,
"dateAdded": "2026-11-12",
"notes": "Label faded on the back."
}
}Look up a market price
POST/mcp· get_market_price
Permission: pricing:read
Looks up the current market value from PriceCharting and eBay. It's advisory: use it to explain a price, not to set one. The store's pricing rules set its buy and sell prices.
Arguments
titlestringRequirede.g. Super Mario 64.
consolestringRequirede.g. N64.
conditionstringe.g. Loose, CIB or New.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_market_price",
"arguments": {
"title": "Super Mario 64",
"console": "N64",
"condition": "Loose"
}
}
}'{
"found": true,
"matchedTitle": "Super Mario 64",
"platform": "Nintendo 64",
"condition": "Loose",
"marketPriceCents": 3250,
"loosePriceCents": 3250,
"completePriceCents": 8900,
"newPriceCents": 42500,
"confidence": "high",
"freshness": "fresh",
"asOf": "2026-11-12",
"warnings": [],
"note": "Advisory market value. The store's pricing rules set its buy and sell prices."
}List orders
POST/mcp· list_orders
Permission: orders:read
Lists the store's most recent orders, newest first, optionally by status.
Arguments
statusstringpending, processing, shipped, delivered, cancelled or refunded.
limitintegerMost results to return, 1 to 50. Defaults to 20.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "list_orders",
"arguments": {
"status": "pending",
"limit": 10
}
}
}'{
"count": 1,
"orders": [
{
"id": "k17d4m2p9q8r7s6t5u4v3w2x1",
"orderNumber": "RS-10482",
"orderType": "online",
"status": "shipped",
"paymentStatus": "paid",
"paymentMethod": "card",
"items": [
{
"inventoryId": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"title": "Super Mario 64",
"console": "N64",
"condition": "Loose",
"quantity": 1,
"priceCents": 3499
}
],
"subtotalCents": 3499,
"taxCents": 289,
"shippingCents": 500,
"discountCents": 0,
"totalCents": 4288,
"createdAt": "2026-11-12T16:01:47.000Z",
"paidAt": "2026-11-12T16:02:11.000Z",
"shippedAt": "2026-11-12T18:30:00.000Z",
"carrier": "USPS",
"trackingNumber": "9400111899223197428490",
"customerId": "m29c8b7a6z5y4x3w2v1u0t9s8",
"hasShippingAddress": true
}
]
}Get an order
POST/mcp· get_order
Permission: orders:read
Gets one order by the number customers see, with line items, totals and shipping status. The address is included only with contact sharing on; hasShippingAddress says whether there is one.
Arguments
orderNumberstringRequiredThe order number customers see.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_order",
"arguments": {
"orderNumber": "RS-10482"
}
}
}'{
"found": true,
"order": {
"id": "k17d4m2p9q8r7s6t5u4v3w2x1",
"orderNumber": "RS-10482",
"orderType": "online",
"status": "shipped",
"paymentStatus": "paid",
"paymentMethod": "card",
"items": [
{
"inventoryId": "j57a8kq2v1x9m3c4d5e6f7g8h9",
"title": "Super Mario 64",
"console": "N64",
"condition": "Loose",
"quantity": 1,
"priceCents": 3499
}
],
"subtotalCents": 3499,
"taxCents": 289,
"shippingCents": 500,
"discountCents": 0,
"totalCents": 4288,
"createdAt": "2026-11-12T16:01:47.000Z",
"paidAt": "2026-11-12T16:02:11.000Z",
"shippedAt": "2026-11-12T18:30:00.000Z",
"carrier": "USPS",
"trackingNumber": "9400111899223197428490",
"customerId": "m29c8b7a6z5y4x3w2v1u0t9s8",
"hasShippingAddress": true
}
}Get a sales summary
POST/mcp· get_sales_summary
Permission: analytics:read
Sales today, over 7 days and over 30 days, stock on hand, stock aged over 90 days, and open work: pending orders and trade-ins. Money is cents.
Arguments
(none)objectSend an empty arguments object.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_sales_summary",
"arguments": {}
}
}'{
"asOf": "2026-11-12T19:41:00.000Z",
"sales": {
"today": {
"unitsSold": 7,
"revenueCents": 21493
},
"last7Days": {
"unitsSold": 44,
"revenueCents": 184250
},
"last30Days": {
"unitsSold": 171,
"revenueCents": 731020
}
},
"inventory": {
"itemsInStock": 1240,
"unitsInStock": 1388,
"retailValueCents": 3821550,
"lowStockCount": 12,
"agedOver90Days": {
"count": 86,
"retailValueCents": 214000
}
},
"operations": {
"pendingOrders": 3,
"pendingTradeIns": 2,
"unreadAlerts": 5
},
"topConsolesLast30Days": [
{
"console": "N64",
"count": 31
}
]
}Find customers
POST/mcp· find_customers
Permission: customers:read
Finds customers by part of their name, with trade-in counts. Email and phone come back only with contact sharing on, and contactDetailsShared says which.
Arguments
querystringRequiredPart of the customer's name.
limitintegerMost results to return, 1 to 25. Defaults to 10.
curl -X POST https://flippant-roadrunner-817.convex.site/mcp \
-H "Authorization: Bearer $RETROSWAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "find_customers",
"arguments": {
"query": "rivera"
}
}
}'{
"count": 1,
"contactDetailsShared": false,
"customers": [
{
"id": "m29c8b7a6z5y4x3w2v1u0t9s8",
"name": "Sam Rivera",
"isGuest": false,
"totalTradeIns": 6,
"createdAt": "2026-03-08T14:20:00.000Z"
}
]
}MCP errors
HTTP errors come before the MCP layer. Tool problems come back as a normal tool result with isError set and a message the assistant can repeat to the person.
| What you get | Why |
|---|---|
| 401 | The key is missing, wrong, revoked or expired. |
| 403 Origin not allowed | A web page on an unknown site sent the request. Call /mcp from your app or server. |
| 429 | Over the key's rate limit. Wait for Retry-After seconds. |
| 400, JSON-RPC -32700 | The body isn't JSON. |
| JSON-RPC -32601 | Unknown method. |
| JSON-RPC -32602 | Unknown tool name. |
| Tool result with isError | The key lacks the tool's permission, the arguments are invalid, or the lookup failed and can be tried again. |
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "{\"error\":\"This API key does not have the orders:read permission. The store owner can add it in RetroSwap under Settings > API access.\"}"
}
],
"structuredContent": {
"error": "This API key does not have the orders:read permission. The store owner can add it in RetroSwap under Settings > API access."
},
"isError": true
}
}Webhooks
Webhook deliveries
The store owner adds an endpoint in Settings > Webhooks and RetroSwap POSTs JSON to it. The URL must be a public HTTPS address: private networks, loopback, local hostnames and names that resolve to a private address are refused, and redirects are not followed, so point the endpoint at its final URL.
Each endpoint gets its own signing secret, starting with whsec_. It is shown once, when the endpoint is created or its secret is regenerated, so copy it then. After that only its last four characters are shown.
Every delivery has the same envelope: the event type, a unique eventId, an ISO timestamp, the store id and the event's data. Use eventId to skip a delivery you've already handled.
RetroSwap sends an event whenever the store changes, whatever made the change: the register, the app, a marketplace sync, a repricing rule or the API. Inventory events carry the item, order events the order, and so on, with money in integer cents. Addresses and customer emails are included only when Share customer contact details is on.
Events: inventory.created, inventory.updated (with changedFields), inventory.price_changed (with previousPriceCents and newPriceCents), inventory.sold, inventory.deleted; order.received, order.shipped, order.completed, order.cancelled for online and marketplace orders (register sales are not sent); price.updated when a repricing rule changes a price and price.synced when a marketplace listing takes it; integration.connected, integration.disconnected, integration.error, integration.synced; shipment.created, shipment.label_purchased, shipment.shipped, shipment.delivered; return.requested, return.approved, return.received, return.refunded; and alert.triggered. Send test in Settings > Webhooks sends test.ping.
Content-Type: application/json
User-Agent: RetroSwap-Webhook/1.0
X-RetroSwap-Timestamp: 1794512460
X-RetroSwap-Signature: sha256=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd{
"event": "inventory.created",
"eventId": "evt_mh9x2k1c_4f7a9b2e",
"timestamp": "2026-11-12T19:41:00.000Z",
"storeId": "k57b2c9d0e1f2a3b4c5d6e7f8a9b0c1d",
"data": {
"item": {
"id": "j97f3a1b2c3d4e5f6a7b8c9d0e1f2a3b",
"sku": "N64-0042",
"title": "Super Mario 64",
"console": "N64",
"quantity": 1,
"status": "In Stock",
"sellPriceCents": 3999
}
}
}Verify signatures
Check every delivery before acting on it. The signature is an HMAC-SHA256, in hex, of the timestamp header, a full stop, and the raw request body, keyed with the endpoint's secret.
Compare in constant time, and reject a timestamp more than five minutes from your clock so an old delivery can't be replayed.
import crypto from "node:crypto";
export function verifyRetroSwap(rawBody, headers, secret) {
const timestamp = headers["x-retroswap-timestamp"];
const signature = String(headers["x-retroswap-signature"]).replace(/^sha256=/, "");
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
return (
signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
);
}Retries
Reply with any 2xx status within 30 seconds to acknowledge a delivery. Any other status, or no answer in time, counts as a failure. Reply quickly and do the work afterwards.
A failed delivery is tried up to five times in all, about 1 minute, 5 minutes, 15 minutes and 1 hour apart. Retries reuse the same eventId, so the same event can arrive more than once.
The delivery log in Settings > Webhooks keeps the last 50 deliveries with each attempt's status. After ten failures in a row the endpoint is turned off and shows as Failing. Fix it, then use Retry or Replay to send a delivery again.
Your plan sets how many deliveries go out each day (UTC): 100 on Pro, and none without a paid plan. Deliveries past the limit are marked failed with a plan limit note and don't count against the endpoint. Test events are always sent.