Skip to content
Cartly Developers

Storefront API

Build custom storefronts with our public REST API. No authentication required.

Overview

The Storefront API is a public, read-heavy REST API designed for building custom storefronts. No authentication is required — just include the X-Shop-ID header to identify which store you are querying.

{shop_id} / X-Shop-ID is your Store ID — the shop UUID shown in the admin under Settings → Store Information (with a copy button).

All responses are JSON. Monetary values are in cents (integer). All timestamps are ISO 8601 / UTC.

Workflow

A typical storefront integration follows this flow:

  1. Browse products — list products, collections, search
  2. Add to cart — create a cart session, add/update items
  3. Checkout — submit shipping and payment info
  4. Order status — track the order after purchase

List Products

bashGET /shops/:id/products
curl "https://cartly.pro/shops/{shop_id}/products?page=1&limit=20" \
  -H "X-Shop-ID: {shop_id}"
jsonResponse
{
  "products": [
    {
      "id": "prod_01H...",
      "title": "Classic T-Shirt",
      "slug": "classic-t-shirt",
      "description": "Premium cotton t-shirt",
      "status": "active",
      "variants": [
        {
          "id": "var_01H...",
          "title": "Small / Black",
          "price": 2999,
          "compare_at_price": 3999,
          "sku": "TSH-SM-BLK",
          "inventory_quantity": 42
        }
      ],
      "images": [
        { "url": "https://cdn.cartly.pro/...", "alt": "Classic T-Shirt" }
      ]
    }
  ],
  "total": 156,
  "page": 1,
  "limit": 20
}

Search

bashFull-text search
curl "https://cartly.pro/shops/{shop_id}/search?q=shirt&limit=10" \
  -H "X-Shop-ID: {shop_id}"

Cart Operations

bashAdd to cart and view cart
# Add to cart
curl -X POST "https://cartly.pro/shops/{shop_id}/cart/items" \
  -H "X-Shop-ID: {shop_id}" \
  -H "Content-Type: application/json" \
  -H "Cookie: cart_session=SESSION_ID" \
  -d '{
    "variant_id": "var_01H...",
    "quantity": 2
  }'

# View cart
curl "https://cartly.pro/shops/{shop_id}/cart" \
  -H "X-Shop-ID: {shop_id}" \
  -H "Cookie: cart_session=SESSION_ID"

Checkout

bashCreate a checkout
# Create checkout
curl -X POST "https://cartly.pro/shops/{shop_id}/checkout" \
  -H "X-Shop-ID: {shop_id}" \
  -H "Content-Type: application/json" \
  -H "Cookie: cart_session=SESSION_ID" \
  -d '{
    "email": "customer@example.com",
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "address1": "123 Main St",
      "city": "New York",
      "state": "NY",
      "zip": "10001",
      "country": "US"
    },
    "shipping_method_id": "zone:...",
    "payment_method_id": "pm_..."
  }'

Endpoints

MethodPathDescription
GET/shops/:id/productsList products (paginated)
GET/shops/:id/products/:slugGet product by slug
GET/shops/:id/collectionsList collections
GET/shops/:id/collections/:slugGet collection with products
GET/shops/:id/searchFull-text product search
POST/shops/:id/cart/itemsAdd item to cart
PUT/shops/:id/cart/items/:idUpdate cart item quantity
DELETE/shops/:id/cart/items/:idRemove cart item
GET/shops/:id/cartGet cart contents
POST/shops/:id/checkoutCreate checkout
GET/shops/:id/orders/:idGet order status
GET/shops/:id/pages/:handleGet CMS page
GET/shops/:id/blogList blog articles
GET/shops/:id/blog/:slugGet blog article
GET/shops/:id/menuGet navigation menus
POST/shops/:id/shipping/ratesGet shipping rates

Pagination

List endpoints support cursor-based pagination with page and limit query parameters. The response includes total, page, and limit fields.

  • page — page number (default: 1)
  • limit — items per page (default: 20, max: 100)

Error Handling

The API returns standard HTTP status codes. Error responses include a JSON body:

jsonError response format
{
  "error": {
    "code": 404,
    "message": "Product not found"
  }
}

Common status codes:

  • 200 — Success
  • 400 — Bad request (invalid parameters)
  • 404 — Resource not found
  • 429 — Rate limited
  • 500 — Internal server error