How to call the LitCommerce API

This article guides you through authenticating, using API tools, and tracking a background job with the LitCommerce API.

[!INFO]

  • The base address for all API calls is https://mcp.litcommerce.com.
  • An API token is scoped to one Main Store, so store_id is not required. If provided, the value must match the store associated with the token.

Test the API in your browser

Follow the steps below to proceed.

  1. Copy your generated LitCommerce API tokens.

  2. Open https://mcp.litcommerce.com/docs for the interactive page.

  3. Click Authorize, paste your token, and confirm with Authorize.

    image.png image.png

[!INFO] The API token is stored in your browser. The full machine-readable specification is available at https://mcp.litcommerce.com/api/v1/openapi.json, including action inputs, permissions, limits, and error codes.

Send API requests

[!INFO]

  • Send Authorization: Bearer lc_live_... on every request.
  • Request bodies are JSON up to 1 MB.
  • Image uploads use a separate upload endpoint (up to 10 MB per image).
Method and path Use
GET /api/v1/tools List the actions available to your token, with their input schema
POST /api/v1/tools/{name} Call one action; the JSON body is the action input
GET /api/v1/operations/{op_id} Status of a background job; same as get_operation
curl https://mcp.litcommerce.com/api/v1/tools \
  -H "Authorization: Bearer $LITCOMMERCE_TOKEN"

[!INFO] The reply shows your Main Store type (cart or litc) and the actions you can call. Actions that do not fit your Main Store or permissions are not listed.

curl -X POST https://mcp.litcommerce.com/api/v1/tools/find_products \
  -H "Authorization: Bearer $LITCOMMERCE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "active", "in_stock": false, "limit": 20}'

If the reply has next_cursor, send it back as cursor to get the next page.

Perform update actions via API

Actions that modify data use a three-step process: preview, then confirm, and apply. Refer to Manage your LitCommerce data with AI and API tools for how the preview and confirmation work.

Field What it does
dry_run true (default) previews only. false applies the change.
confirmation_token Proves the plan was previewed. Valid for 10 minutes, single use, and tied to that exact plan.
idempotency_key A value you choose, at least 8 characters. Sending the same key with the same input returns the earlier result (idempotent_replay: true) instead of changing the data twice.
  1. Preview

    Call the action without dry_run. The reply contains the plan and a confirmation_token.

    curl -X POST https://mcp.litcommerce.com/api/v1/tools/update_inventory \
      -H "Authorization: Bearer $LITCOMMERCE_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"items": [{"product_id": "<id>", "qty": 20}]}'
    
  2. Confirm

    Check the proposed changes to ensure all included data is correct and the proposed updates match your intent.

  3. Apply

    Call the action again with the same items, plus dry_run, confirmation_token, and idempotency_key.

    curl -X POST https://mcp.litcommerce.com/api/v1/tools/update_inventory \
      -H "Authorization: Bearer $LITCOMMERCE_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"items": [{"product_id": "<id>", "qty": 20}], "dry_run": false, "confirmation_token": "<token>", "idempotency_key": "stock-2026-11-23-001"}'
    

    The exact item fields for each action are in the action's schema from GET /api/v1/tools.

[!INFO] update_inventory works only with LitCommerce as the Main Store. If your Main Store is a shopping cart, the request returns wrong_main_store.

Track background jobs

When a response includes an op_id, check the operation status at GET /api/v1/operations/{op_id}. Wait the number of seconds specified in next_check_after before checking again.

FAQs

See the recommended solution for each scenario below:

The action returns plan_changed and writes nothing. Preview again and confirm the new proposed change.

The response is 429 with a Retry-After header. Limits are counted per store and shared by the MCP server and the API.

Open the Rate Limits tab in API/MCP to see your current usage. Available limits vary depending on your subscription plan and listing allowance.

Errors have the form {"error": "<code>", "message": "<description>"}. See What do the API error codes mean?.

If you have any questions, let us know via the Chat Box in the bottom-right corner of our Help Center.