Skip to main content

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

OpenAPI filellms.txtCreate an API key

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.
GET/api/v1/stats
curl https://flippant-roadrunner-817.convex.site/api/v1/stats \
  -H "Authorization: Bearer $RETROSWAP_API_KEY"
Base URL
https://flippant-roadrunner-817.convex.site/api/v1

Authentication

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.

GET/api/v1/inventory
curl -G https://flippant-roadrunner-817.convex.site/api/v1/inventory \
  -H "Authorization: Bearer $RETROSWAP_API_KEY" \
  -d limit=1
Either header works
Authorization: Bearer rs_your_api_key
X-API-Key: rs_your_api_key

Permissions

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.

PermissionWhat it allows
inventory:readList and get inventory items. MCP: search_inventory, get_inventory_item.
inventory:writeAdd inventory items with POST /api/v1/inventory.
orders:readList orders. MCP: list_orders, get_order. Shipping addresses and notes only with contact sharing on.
orders:writeCan be granted; no route uses it yet.
customers:readList customers. MCP: find_customers. Email, phone and notes only with contact sharing on.
customers:writeCan be granted; no route uses it yet.
analytics:readKPIs and quick stats. MCP: get_sales_summary.
pricing:readMCP: get_market_price.
pricing:writeCan be granted; no route uses it yet.
webhooks:manageCan 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.

StatusMeaning
200 OKIt worked.
201 CreatedThe item was added.
400 Bad RequestA required field is missing or a value is out of range.
401 UnauthorizedThe key is missing, wrong, revoked or expired, or the store is closed.
403 ForbiddenThe key lacks the permission the route needs.
404 Not FoundNo such record in this store.
429 Too Many RequestsOver the key's rate limit. Wait for Retry-After seconds.
500 Internal Server ErrorSomething failed on RetroSwap's side. Retry with backoff.
Error body403
{
  "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.

Response headers
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.

GET/api/v1/orders
curl -G https://flippant-roadrunner-817.convex.site/api/v1/orders \
  -H "Authorization: Bearer $RETROSWAP_API_KEY" \
  -d limit=50 \
  -d offset=50

Money

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.

One price, two fields
{
  "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

  • _idstring

    Unique id of the item.

  • skustring

    The store's SKU, if it has one.

  • titlestring

    Title as shown on the shelf, e.g. Super Mario 64.

  • consolestring

    Console or platform, e.g. N64.

  • regionstring

    Region, e.g. NTSC-U or PAL.

  • itemTypestring

    Game, console, accessory and so on.

  • productCategorystring

    The store's category for the item.

  • conditionstring

    Condition, e.g. Loose, CIB or New.

  • hasBoxboolean

    Whether the box is included.

  • hasManualboolean

    Whether the manual is included.

  • quantityinteger

    Units on hand.

  • statusstring

    Where the item is, e.g. In Stock, Sold or Trade-In Pending.

  • sellPricenumber

    Shelf price in dollars.

  • sellPriceCentsinteger

    Shelf price in cents. Prefer this.

  • buyPricenumber

    What the store paid, in dollars.

  • buyPriceCentsinteger

    What the store paid, in cents.

  • marketPricenumber

    Market value in dollars.

  • marketPriceCentsinteger

    Market value in cents.

  • dateAddedstring

    Date added, YYYY-MM-DD.

  • upcstring

    Barcode, if known.

  • imageUrlstring

    Photo URL, if the item has one.

  • notesstring

    Staff notes.

The inventory item objectJSON
{
  "_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

  • statusstring

    Only items with this status, e.g. In Stock, Sold or Trade-In Pending.

  • consolestring

    Only this exact console, e.g. N64.

  • limitinteger

    How many to return, 1 to 500. Defaults to 100.

  • offsetinteger

    How many to skip first. Defaults to 0.

Returns

An array of inventory item objects.

GET/api/v1/inventory
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
Response200
[
  {
    "_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

  • titlestringRequired

    Title of the item.

  • consolestringRequired

    Console or platform.

  • itemTypestringRequired

    Game, console, accessory and so on.

  • productCategorystring

    The store's category.

  • conditionstring

    e.g. Loose, CIB or New.

  • regionstring

    e.g. NTSC-U or PAL.

  • sellPriceCentsinteger

    Shelf price in cents.

  • sellPricenumber

    Shelf price in dollars. Ignored when sellPriceCents is sent.

  • buyPriceCentsinteger

    What the store paid, in cents.

  • buyPricenumber

    What the store paid, in dollars. Ignored when buyPriceCents is sent.

  • quantityinteger

    Units on hand.

  • hasBoxboolean

    Box included.

  • hasManualboolean

    Manual included.

  • notesstring

    Staff notes.

  • imageUrlstring

    A photo URL.

  • skustring

    The store's SKU.

  • upcstring

    Barcode.

Returns

201 with the new inventory item object. 400 when title, console or itemType is missing.

POST/api/v1/inventory
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
  }'
Response201
{
  "_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

  • idstringRequired

    The item's _id.

Returns

An inventory item object, or 404 if this store has no such item.

GET/api/v1/inventory/j57a8kq2v1x9m3c4d5e6f7g8h9
curl https://flippant-roadrunner-817.convex.site/api/v1/inventory/j57a8kq2v1x9m3c4d5e6f7g8h9 \
  -H "Authorization: Bearer $RETROSWAP_API_KEY"
Response200
{
  "_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

  • _idstring

    Unique id of the order.

  • customerIdstring

    The customer, if the order has one.

  • orderTypestring

    Where it came from: pos, online, ebay, shopify or manual.

  • orderNumberstring

    The number customers see.

  • externalOrderIdstring

    The marketplace's own id, for eBay, Shopify or Amazon orders.

  • statusstring

    pending, processing, shipped, delivered, cancelled or refunded.

  • itemsarray of objects

    The lines on the order.

    Show child attributes
    • inventoryIdstring

      The inventory item sold.

    • titlestring

      Title at the time of sale.

    • consolestring

      Console at the time of sale.

    • quantityinteger

      Units on this line.

    • priceinteger

      Price per unit, in cents.

    • conditionstring

      Condition at the time of sale.

  • subtotalinteger

    Before tax, shipping and discounts, in cents.

  • taxinteger

    Tax, in cents.

  • shippinginteger

    Shipping charged, in cents.

  • discountinteger

    Discounts, in cents.

  • totalinteger

    What the customer paid, in cents.

  • paymentStatusstring

    Payment state, e.g. paid or refunded.

  • paymentMethodstring

    How it was paid.

  • paidAtstring

    When it was paid, ISO 8601.

  • couponCodestring

    Coupon used, if any.

  • trackingNumberstring

    Carrier tracking number.

  • carrierstring

    Shipping carrier, e.g. USPS.

  • shippedAtstring

    When it shipped, ISO 8601.

  • deliveredAtstring

    When it was delivered, ISO 8601.

  • createdAtstring

    When it was placed, ISO 8601.

  • updatedAtstring

    When it last changed, ISO 8601.

  • shippingAddressobject

    Ship-to address. Only when the store owner shares customer contact details.

  • customerNotesstring

    Notes from the customer. Only when the store owner shares customer contact details.

  • internalNotesstring

    Staff notes. Only when the store owner shares customer contact details.

The order objectJSON
{
  "_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

  • statusstring

    Only orders with this status: pending, processing, shipped, delivered, cancelled or refunded.

  • limitinteger

    How many to return, 1 to 500. Defaults to 100.

  • offsetinteger

    How many to skip first. Defaults to 0.

Returns

An array of order objects.

GET/api/v1/orders
curl -G https://flippant-roadrunner-817.convex.site/api/v1/orders \
  -H "Authorization: Bearer $RETROSWAP_API_KEY" \
  -d status=shipped \
  -d limit=10
Response200
[
  {
    "_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

  • _idstring

    Unique id of the customer.

  • namestring

    The customer's name.

  • createdAtstring

    When the record was made, ISO 8601.

  • isGuestboolean

    True for a guest checkout without an account.

  • totalTradeInsinteger

    How many trade-ins they've made.

  • totalValuenumber

    Total trade-in value, in dollars.

  • emailstring

    Email address. Only when the store owner shares customer contact details.

  • phonestring

    Phone number. Only when the store owner shares customer contact details.

  • notesstring

    Staff notes. Only when the store owner shares customer contact details.

The customer objectJSON
{
  "_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

  • limitinteger

    How many to return, 1 to 500. Defaults to 100.

  • offsetinteger

    How many to skip first. Defaults to 0.

Returns

An array of customer objects.

GET/api/v1/customers
curl -G https://flippant-roadrunner-817.convex.site/api/v1/customers \
  -H "Authorization: Bearer $RETROSWAP_API_KEY" \
  -d limit=25
Response200
[
  {
    "_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

  • periodstring

    today, week, month, quarter or year. Defaults to month.

Returns

A KPI object.

GET/api/v1/analytics/kpis
curl -G https://flippant-roadrunner-817.convex.site/api/v1/analytics/kpis \
  -H "Authorization: Bearer $RETROSWAP_API_KEY" \
  -d period=week
Response200
{
  "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.

GET/api/v1/stats
curl https://flippant-roadrunner-817.convex.site/api/v1/stats \
  -H "Authorization: Bearer $RETROSWAP_API_KEY"
Response200
{
  "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.

POST/mcp
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"
      }
    }
  }'
Response200
{
  "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 Code
claude mcp add --transport http retroswap https://your-deployment.convex.site/mcp --header "Authorization: Bearer rs_your_api_key"
MCP settings (Cursor, VS Code, Windsurf)JSON
{
  "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.

POST/mcp
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"
  }'
Response200
{
  "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

  • querystring

    Words from the title, e.g. zelda.

  • consolestring

    Exact console name, e.g. N64.

  • statusstring

    Exact status, e.g. In Stock, Sold or Trade-In Pending.

  • limitinteger

    Most results to return, 1 to 50. Defaults to 20.

POST/mcp
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
      }
    }
  }'
Result (structuredContent)200
{
  "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

  • idstring

    Item id from search_inventory.

  • skustring

    The item's SKU.

POST/mcp
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"
      }
    }
  }'
Result (structuredContent)200
{
  "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

  • titlestringRequired

    e.g. Super Mario 64.

  • consolestringRequired

    e.g. N64.

  • conditionstring

    e.g. Loose, CIB or New.

POST/mcp
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"
      }
    }
  }'
Result (structuredContent)200
{
  "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

  • statusstring

    pending, processing, shipped, delivered, cancelled or refunded.

  • limitinteger

    Most results to return, 1 to 50. Defaults to 20.

POST/mcp
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
      }
    }
  }'
Result (structuredContent)200
{
  "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

  • orderNumberstringRequired

    The order number customers see.

POST/mcp
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"
      }
    }
  }'
Result (structuredContent)200
{
  "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)object

    Send an empty arguments object.

POST/mcp
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": {}
    }
  }'
Result (structuredContent)200
{
  "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

  • querystringRequired

    Part of the customer's name.

  • limitinteger

    Most results to return, 1 to 25. Defaults to 10.

POST/mcp
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"
      }
    }
  }'
Result (structuredContent)200
{
  "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 getWhy
401The key is missing, wrong, revoked or expired.
403 Origin not allowedA web page on an unknown site sent the request. Call /mcp from your app or server.
429Over the key's rate limit. Wait for Retry-After seconds.
400, JSON-RPC -32700The body isn't JSON.
JSON-RPC -32601Unknown method.
JSON-RPC -32602Unknown tool name.
Tool result with isErrorThe key lacks the tool's permission, the arguments are invalid, or the lookup failed and can be tried again.
Tool result with isError200
{
  "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.

Request headers
Content-Type: application/json
User-Agent: RetroSwap-Webhook/1.0
X-RetroSwap-Timestamp: 1794512460
X-RetroSwap-Signature: sha256=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
Event envelopeJSON
{
  "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.

Verify in Node.js
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.