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:
- Browse products — list products, collections, search
- Add to cart — create a cart session, add/update items
- Checkout — submit shipping and payment info
- Order status — track the order after purchase
List Products
curl "https://cartly.pro/shops/{shop_id}/products?page=1&limit=20" \
-H "X-Shop-ID: {shop_id}"{
"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
curl "https://cartly.pro/shops/{shop_id}/search?q=shirt&limit=10" \
-H "X-Shop-ID: {shop_id}"Cart Operations
# 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
# 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
| Method | Path | Description |
|---|---|---|
| GET | /shops/:id/products | List products (paginated) |
| GET | /shops/:id/products/:slug | Get product by slug |
| GET | /shops/:id/collections | List collections |
| GET | /shops/:id/collections/:slug | Get collection with products |
| GET | /shops/:id/search | Full-text product search |
| POST | /shops/:id/cart/items | Add item to cart |
| PUT | /shops/:id/cart/items/:id | Update cart item quantity |
| DELETE | /shops/:id/cart/items/:id | Remove cart item |
| GET | /shops/:id/cart | Get cart contents |
| POST | /shops/:id/checkout | Create checkout |
| GET | /shops/:id/orders/:id | Get order status |
| GET | /shops/:id/pages/:handle | Get CMS page |
| GET | /shops/:id/blog | List blog articles |
| GET | /shops/:id/blog/:slug | Get blog article |
| GET | /shops/:id/menu | Get navigation menus |
| POST | /shops/:id/shipping/rates | Get 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:
{
"error": {
"code": 404,
"message": "Product not found"
}
}Common status codes:
200— Success400— Bad request (invalid parameters)404— Resource not found429— Rate limited500— Internal server error