Commerce API
Common Information
Base URL
/api/v1Authentication Header
Authorization: Bearer <access_token>Response Envelope
All responses follow the standard format:
// Success response
interface SuccessResponse<T> {
success: true;
data: T;
meta?: {
pagination?: PaginationMeta;
[key: string]: unknown;
};
}
// Error response
interface ErrorResponse {
success: false;
error: {
code: string;
message: string;
details?: Record<string, string[]>;
};
}Pagination Format
interface PaginationMeta {
total: number;
page: number;
pageSize: number;
totalPages: number;
hasNext: boolean;
hasPrevious: boolean;
}Rate Limits
| Endpoint | Limit |
|---|---|
| Product listing/details | 200/min |
| Cart operations | 100/min |
| POST /cart/checkout | 2/min per user |
| Order operations | 100/min |
Financial Endpoint Rate Limit Headers
X-RateLimit-Limit: 2
X-RateLimit-Remaining: 1
X-RateLimit-Reset: 1705329600
X-RateLimit-Policy: financialProduct Endpoints
GET /api/v1/products
List products with filtering and pagination.
Authentication: Public
Rate Limit: 200 requests per minute
Request Headers
Authorization: Bearer <access_token> (optional - for personalized pricing)Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number (optional) |
| pageSize | number | Items per page, max 100 (optional) |
| categoryId | string | Filter by category UUID (optional) |
| status | string | Filter: 'ACTIVE', 'OUT_OF_STOCK' (optional) |
| minPrice | number | Minimum price filter (optional) |
| maxPrice | number | Maximum price filter (optional) |
| search | string | Full-text search on name/description (optional) |
| sortBy | string | Sort field: 'price', 'name', 'createdAt', 'popularity' (optional) |
| sortOrder | string | Sort direction: 'asc', 'desc' (optional) |
| tags | string | Comma-separated tag filter (optional) |
Response (200 OK)
interface ProductsResponse {
products: Product[];
}
interface Product {
id: string;
name: string;
slug: string;
description: string;
shortDescription: string | null;
price: number;
compareAtPrice: number | null;
currency: string;
sku: string;
status: 'ACTIVE' | 'DRAFT' | 'ARCHIVED' | 'OUT_OF_STOCK';
stockQuantity: number | null;
category: {
id: string;
name: string;
slug: string;
} | null;
images: {
id: string;
url: string;
thumbnailUrl: string;
alt: string | null;
isPrimary: boolean;
}[];
tags: string[];
rating: {
average: number;
count: number;
};
commissionPercentage: number;
careerPointsPercentage: number;
createdAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid query parameters |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/products?categoryId=cat-123&minPrice=1000&maxPrice=50000&sortBy=price&sortOrder=asc&page=1&pageSize=20"Response:
{
"success": true,
"data": {
"products": [
{
"id": "pp0e8400-e29b-41d4-a716-446655440001",
"name": "Premium Health Supplement",
"slug": "premium-health-supplement",
"description": "A comprehensive health supplement with essential vitamins and minerals.",
"shortDescription": "Essential vitamins and minerals",
"price": 2500,
"compareAtPrice": 3000,
"currency": "RUB",
"sku": "SUP-001",
"status": "ACTIVE",
"stockQuantity": 150,
"category": {
"id": "cat-123",
"name": "Health Supplements",
"slug": "health-supplements"
},
"images": [
{
"id": "img-001",
"url": "https://cdn.iwm-platform.com/products/sup-001-full.jpg",
"thumbnailUrl": "https://cdn.iwm-platform.com/products/sup-001-thumb.jpg",
"alt": "Premium Health Supplement bottle",
"isPrimary": true
}
],
"tags": ["health", "vitamins", "bestseller"],
"rating": {
"average": 4.7,
"count": 156
},
"commissionPercentage": 10,
"careerPointsPercentage": 5,
"createdAt": "2024-01-01T10:00:00Z"
}
]
},
"meta": {
"pagination": {
"total": 85,
"page": 1,
"pageSize": 20,
"totalPages": 5,
"hasNext": true,
"hasPrevious": false
}
}
}GET /api/v1/products/:id
Get product details.
Authentication: Public
Rate Limit: 200 requests per minute
Request Headers
Authorization: Bearer <access_token> (optional - for personalized pricing)Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Product ID |
Request Body
None
Query Parameters
None
Response (200 OK)
interface ProductDetailResponse {
id: string;
name: string;
slug: string;
description: string;
shortDescription: string | null;
price: number;
compareAtPrice: number | null;
currency: string;
sku: string;
status: 'ACTIVE' | 'DRAFT' | 'ARCHIVED' | 'OUT_OF_STOCK';
stockQuantity: number | null;
trackInventory: boolean;
weight: number | null;
dimensions: {
length: number | null;
width: number | null;
height: number | null;
};
category: {
id: string;
name: string;
slug: string;
breadcrumb: {
id: string;
name: string;
slug: string;
}[];
} | null;
images: {
id: string;
url: string;
thumbnailUrl: string;
alt: string | null;
isPrimary: boolean;
position: number;
}[];
variants: {
id: string;
name: string;
sku: string;
price: number;
stockQuantity: number | null;
attributes: Record<string, string>;
}[];
attributes: Record<string, string>;
tags: string[];
rating: {
average: number;
count: number;
distribution: {
1: number;
2: number;
3: number;
4: number;
5: number;
};
};
commissionPercentage: number;
careerPointsPercentage: number;
relatedProducts: {
id: string;
name: string;
slug: string;
price: number;
thumbnailUrl: string | null;
}[];
createdAt: string;
updatedAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 404 | PRODUCT_NOT_FOUND | Product not found |
Example
Request:
curl -X GET https://api.iwm-platform.com/api/v1/products/pp0e8400-e29b-41d4-a716-446655440001Response:
{
"success": true,
"data": {
"id": "pp0e8400-e29b-41d4-a716-446655440001",
"name": "Premium Health Supplement",
"slug": "premium-health-supplement",
"description": "A comprehensive health supplement with essential vitamins and minerals for daily wellness.",
"shortDescription": "Essential vitamins and minerals",
"price": 2500,
"compareAtPrice": 3000,
"currency": "RUB",
"sku": "SUP-001",
"status": "ACTIVE",
"stockQuantity": 150,
"trackInventory": true,
"weight": 250,
"dimensions": {
"length": 10,
"width": 10,
"height": 15
},
"category": {
"id": "cat-123",
"name": "Health Supplements",
"slug": "health-supplements",
"breadcrumb": [
{ "id": "cat-001", "name": "Health & Wellness", "slug": "health-wellness" },
{ "id": "cat-123", "name": "Health Supplements", "slug": "health-supplements" }
]
},
"images": [
{
"id": "img-001",
"url": "https://cdn.iwm-platform.com/products/sup-001-full.jpg",
"thumbnailUrl": "https://cdn.iwm-platform.com/products/sup-001-thumb.jpg",
"alt": "Premium Health Supplement bottle",
"isPrimary": true,
"position": 1
}
],
"variants": [],
"attributes": {
"servingSize": "2 capsules",
"servingsPerContainer": "60",
"form": "Capsules"
},
"tags": ["health", "vitamins", "bestseller"],
"rating": {
"average": 4.7,
"count": 156,
"distribution": {
"1": 2,
"2": 5,
"3": 12,
"4": 45,
"5": 92
}
},
"commissionPercentage": 10,
"careerPointsPercentage": 5,
"relatedProducts": [
{
"id": "pp0e8400-e29b-41d4-a716-446655440002",
"name": "Omega-3 Fish Oil",
"slug": "omega-3-fish-oil",
"price": 1800,
"thumbnailUrl": "https://cdn.iwm-platform.com/products/omega-thumb.jpg"
}
],
"createdAt": "2024-01-01T10:00:00Z",
"updatedAt": "2024-01-15T12:00:00Z"
}
}GET /api/v1/products/:id/reviews
Get product reviews.
Authentication: Public
Rate Limit: 200 requests per minute
Request Headers
Authorization: Bearer <access_token> (optional)Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Product ID |
Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number (optional) |
| pageSize | number | Items per page, max 50 (optional) |
| rating | number | Filter by rating (1-5) (optional) |
| sortBy | string | Sort field: 'createdAt', 'rating', 'helpful' (optional) |
| sortOrder | string | Sort direction: 'asc', 'desc' (optional) |
Response (200 OK)
interface ProductReviewsResponse {
reviews: Review[];
summary: {
average: number;
count: number;
distribution: {
1: number;
2: number;
3: number;
4: number;
5: number;
};
};
}
interface Review {
id: string;
author: {
id: string;
name: string;
avatarUrl: string | null;
isVerifiedPurchaser: boolean;
};
rating: number;
title: string | null;
content: string;
pros: string[];
cons: string[];
helpfulCount: number;
isHelpful: boolean | null; // null if user not authenticated
images: {
url: string;
thumbnailUrl: string;
}[];
response: {
content: string;
respondedAt: string;
} | null;
createdAt: string;
updatedAt: string | null;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 404 | PRODUCT_NOT_FOUND | Product not found |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/products/pp0e8400-e29b-41d4-a716-446655440001/reviews?page=1&pageSize=10&sortBy=helpful&sortOrder=desc"Response:
{
"success": true,
"data": {
"reviews": [
{
"id": "rv0e8400-e29b-41d4-a716-446655440001",
"author": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "John D.",
"avatarUrl": "https://cdn.iwm-platform.com/avatars/550e8400.jpg",
"isVerifiedPurchaser": true
},
"rating": 5,
"title": "Excellent quality supplement",
"content": "I've been taking this supplement for a month and noticed significant improvement in my energy levels.",
"pros": ["High quality ingredients", "Easy to swallow", "Fast shipping"],
"cons": ["Price could be lower"],
"helpfulCount": 24,
"isHelpful": null,
"images": [],
"response": {
"content": "Thank you for your feedback! We're glad you're enjoying the product.",
"respondedAt": "2024-01-10T12:00:00Z"
},
"createdAt": "2024-01-08T15:30:00Z",
"updatedAt": null
}
],
"summary": {
"average": 4.7,
"count": 156,
"distribution": {
"1": 2,
"2": 5,
"3": 12,
"4": 45,
"5": 92
}
}
},
"meta": {
"pagination": {
"total": 156,
"page": 1,
"pageSize": 10,
"totalPages": 16,
"hasNext": true,
"hasPrevious": false
}
}
}POST /api/v1/products/:id/reviews
Add a product review.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Product ID |
Request Body
interface CreateReviewRequest {
rating: number; // 1-5
title?: string; // Optional title (max 100 chars)
content: string; // Review content (min 10, max 2000 chars)
pros?: string[]; // List of pros (max 5, each max 100 chars)
cons?: string[]; // List of cons (max 5, each max 100 chars)
}Query Parameters
None
Response (201 Created)
interface CreateReviewResponse {
id: string;
rating: number;
title: string | null;
content: string;
pros: string[];
cons: string[];
status: 'PENDING' | 'PUBLISHED';
createdAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid input data |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 403 | NOT_PURCHASED | Must purchase product to review |
| 404 | PRODUCT_NOT_FOUND | Product not found |
| 409 | ALREADY_REVIEWED | User already reviewed this product |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/products/pp0e8400-e29b-41d4-a716-446655440001/reviews \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"rating": 5,
"title": "Great product",
"content": "This supplement has really helped improve my daily energy levels. Highly recommend!",
"pros": ["High quality", "Fast delivery"],
"cons": ["Packaging could be better"]
}'Response:
{
"success": true,
"data": {
"id": "rv0e8400-e29b-41d4-a716-446655440002",
"rating": 5,
"title": "Great product",
"content": "This supplement has really helped improve my daily energy levels. Highly recommend!",
"pros": ["High quality", "Fast delivery"],
"cons": ["Packaging could be better"],
"status": "PENDING",
"createdAt": "2024-01-15T20:00:00Z"
}
}Category Endpoints
GET /api/v1/categories
List all categories.
Authentication: Public
Rate Limit: 200 requests per minute
Request Headers
None required
Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| parentId | string | Filter by parent category (optional, null for root) |
| includeProducts | boolean | Include product count (optional) |
Response (200 OK)
interface CategoriesResponse {
categories: Category[];
}
interface Category {
id: string;
name: string;
slug: string;
description: string | null;
imageUrl: string | null;
parentId: string | null;
level: number;
position: number;
productCount: number | null;
children: Category[];
isActive: boolean;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid query parameters |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/categories?includeProducts=true"Response:
{
"success": true,
"data": {
"categories": [
{
"id": "cat-001",
"name": "Health & Wellness",
"slug": "health-wellness",
"description": "Products for your health and wellbeing",
"imageUrl": "https://cdn.iwm-platform.com/categories/health.jpg",
"parentId": null,
"level": 0,
"position": 1,
"productCount": 125,
"children": [
{
"id": "cat-123",
"name": "Health Supplements",
"slug": "health-supplements",
"description": "Vitamins, minerals, and supplements",
"imageUrl": "https://cdn.iwm-platform.com/categories/supplements.jpg",
"parentId": "cat-001",
"level": 1,
"position": 1,
"productCount": 85,
"children": [],
"isActive": true
}
],
"isActive": true
}
]
}
}GET /api/v1/categories/:id
Get category with products.
Authentication: Public
Rate Limit: 200 requests per minute
Request Headers
None required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Category ID |
Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number for products (optional) |
| pageSize | number | Items per page, max 100 (optional) |
| sortBy | string | Sort products by: 'price', 'name', 'createdAt', 'popularity' (optional) |
| sortOrder | string | Sort direction: 'asc', 'desc' (optional) |
Response (200 OK)
interface CategoryDetailResponse {
id: string;
name: string;
slug: string;
description: string | null;
imageUrl: string | null;
parent: {
id: string;
name: string;
slug: string;
} | null;
breadcrumb: {
id: string;
name: string;
slug: string;
}[];
children: {
id: string;
name: string;
slug: string;
productCount: number;
}[];
products: Product[];
filters: {
priceRange: {
min: number;
max: number;
};
tags: {
name: string;
count: number;
}[];
};
}Error Responses
| Status | Code | Description |
|---|---|---|
| 404 | CATEGORY_NOT_FOUND | Category not found |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/categories/cat-123?page=1&pageSize=20"Response:
{
"success": true,
"data": {
"id": "cat-123",
"name": "Health Supplements",
"slug": "health-supplements",
"description": "Vitamins, minerals, and supplements for daily wellness",
"imageUrl": "https://cdn.iwm-platform.com/categories/supplements.jpg",
"parent": {
"id": "cat-001",
"name": "Health & Wellness",
"slug": "health-wellness"
},
"breadcrumb": [
{ "id": "cat-001", "name": "Health & Wellness", "slug": "health-wellness" },
{ "id": "cat-123", "name": "Health Supplements", "slug": "health-supplements" }
],
"children": [
{ "id": "cat-124", "name": "Vitamins", "slug": "vitamins", "productCount": 32 },
{ "id": "cat-125", "name": "Minerals", "slug": "minerals", "productCount": 18 }
],
"products": [],
"filters": {
"priceRange": {
"min": 500,
"max": 15000
},
"tags": [
{ "name": "vitamins", "count": 32 },
{ "name": "bestseller", "count": 15 }
]
}
},
"meta": {
"pagination": {
"total": 85,
"page": 1,
"pageSize": 20,
"totalPages": 5,
"hasNext": true,
"hasPrevious": false
}
}
}Cart Endpoints
GET /api/v1/cart
Get current cart.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Request Body
None
Query Parameters
None
Response (200 OK)
interface CartResponse {
id: string;
items: CartItem[];
summary: {
subtotal: number;
discount: number;
shipping: number | null;
tax: number;
total: number;
currency: string;
itemCount: number;
totalQuantity: number;
};
appliedCoupons: {
code: string;
discount: number;
type: 'PERCENTAGE' | 'FIXED';
}[];
estimatedCommission: number | null;
estimatedCareerPoints: number | null;
updatedAt: string;
}
interface CartItem {
id: string;
product: {
id: string;
name: string;
slug: string;
sku: string;
price: number;
compareAtPrice: number | null;
thumbnailUrl: string | null;
status: string;
stockQuantity: number | null;
};
variantId: string | null;
variantAttributes: Record<string, string> | null;
quantity: number;
unitPrice: number;
totalPrice: number;
addedAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or expired access token |
Example
Request:
curl -X GET https://api.iwm-platform.com/api/v1/cart \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"id": "ct0e8400-e29b-41d4-a716-446655440001",
"items": [
{
"id": "ci0e8400-e29b-41d4-a716-446655440001",
"product": {
"id": "pp0e8400-e29b-41d4-a716-446655440001",
"name": "Premium Health Supplement",
"slug": "premium-health-supplement",
"sku": "SUP-001",
"price": 2500,
"compareAtPrice": 3000,
"thumbnailUrl": "https://cdn.iwm-platform.com/products/sup-001-thumb.jpg",
"status": "ACTIVE",
"stockQuantity": 150
},
"variantId": null,
"variantAttributes": null,
"quantity": 2,
"unitPrice": 2500,
"totalPrice": 5000,
"addedAt": "2024-01-15T18:00:00Z"
}
],
"summary": {
"subtotal": 5000,
"discount": 0,
"shipping": null,
"tax": 1000,
"total": 6000,
"currency": "RUB",
"itemCount": 1,
"totalQuantity": 2
},
"appliedCoupons": [],
"estimatedCommission": null,
"estimatedCareerPoints": null,
"updatedAt": "2024-01-15T18:00:00Z"
}
}POST /api/v1/cart/items
Add item to cart.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Request Body
interface AddCartItemRequest {
productId: string; // Product UUID
variantId?: string; // Product variant UUID (if applicable)
quantity: number; // Quantity to add (min 1)
}Query Parameters
None
Response (201 Created)
interface AddCartItemResponse {
cartItemId: string;
product: {
id: string;
name: string;
};
quantity: number;
unitPrice: number;
totalPrice: number;
cartSummary: {
total: number;
itemCount: number;
totalQuantity: number;
};
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid input data |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | PRODUCT_NOT_FOUND | Product not found |
| 404 | VARIANT_NOT_FOUND | Product variant not found |
| 400 | PRODUCT_UNAVAILABLE | Product is not available |
| 400 | INSUFFICIENT_STOCK | Not enough stock available |
| 400 | MAX_QUANTITY_EXCEEDED | Maximum quantity per item exceeded |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/cart/items \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"productId": "pp0e8400-e29b-41d4-a716-446655440001",
"quantity": 2
}'Response:
{
"success": true,
"data": {
"cartItemId": "ci0e8400-e29b-41d4-a716-446655440001",
"product": {
"id": "pp0e8400-e29b-41d4-a716-446655440001",
"name": "Premium Health Supplement"
},
"quantity": 2,
"unitPrice": 2500,
"totalPrice": 5000,
"cartSummary": {
"total": 6000,
"itemCount": 1,
"totalQuantity": 2
}
}
}PATCH /api/v1/cart/items/:id
Update cart item quantity.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Cart item ID |
Request Body
interface UpdateCartItemRequest {
quantity: number; // New quantity (min 1)
}Query Parameters
None
Response (200 OK)
interface UpdateCartItemResponse {
cartItemId: string;
quantity: number;
unitPrice: number;
totalPrice: number;
cartSummary: {
total: number;
itemCount: number;
totalQuantity: number;
};
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid quantity |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | CART_ITEM_NOT_FOUND | Cart item not found |
| 400 | INSUFFICIENT_STOCK | Not enough stock available |
| 400 | MAX_QUANTITY_EXCEEDED | Maximum quantity exceeded |
Example
Request:
curl -X PATCH https://api.iwm-platform.com/api/v1/cart/items/ci0e8400-e29b-41d4-a716-446655440001 \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"quantity": 3
}'Response:
{
"success": true,
"data": {
"cartItemId": "ci0e8400-e29b-41d4-a716-446655440001",
"quantity": 3,
"unitPrice": 2500,
"totalPrice": 7500,
"cartSummary": {
"total": 9000,
"itemCount": 1,
"totalQuantity": 3
}
}
}DELETE /api/v1/cart/items/:id
Remove item from cart.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Cart item ID |
Request Body
None
Query Parameters
None
Response (200 OK)
interface RemoveCartItemResponse {
message: string;
cartItemId: string;
cartSummary: {
total: number;
itemCount: number;
totalQuantity: number;
};
}Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | CART_ITEM_NOT_FOUND | Cart item not found |
Example
Request:
curl -X DELETE https://api.iwm-platform.com/api/v1/cart/items/ci0e8400-e29b-41d4-a716-446655440001 \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"message": "Item removed from cart",
"cartItemId": "ci0e8400-e29b-41d4-a716-446655440001",
"cartSummary": {
"total": 0,
"itemCount": 0,
"totalQuantity": 0
}
}
}DELETE /api/v1/cart
Clear cart.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Request Body
None
Query Parameters
None
Response (200 OK)
interface ClearCartResponse {
message: string;
itemsRemoved: number;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or expired access token |
Example
Request:
curl -X DELETE https://api.iwm-platform.com/api/v1/cart \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"message": "Cart cleared successfully",
"itemsRemoved": 3
}
}POST /api/v1/cart/checkout
Start checkout process.
Authentication: Required
Rate Limit: 2 requests per minute (financial endpoint)
Request Headers
Authorization: Bearer <access_token>Request Body
interface CheckoutRequest {
shippingAddressId: string; // Saved address ID
billingAddressId?: string; // If different from shipping
shippingMethodId: string; // Selected shipping method
paymentMethod: 'CARD' | 'BANK_TRANSFER' | 'EWALLET' | 'BALANCE';
couponCodes?: string[]; // Applied coupon codes
notes?: string; // Order notes
usePartnerBalance?: boolean; // Use partner balance for payment
}Query Parameters
None
Response (201 Created)
interface CheckoutResponse {
orderId: string;
orderNumber: string;
status: 'PENDING_PAYMENT';
payment: {
method: string;
amount: number;
currency: string;
// For card payments
paymentUrl?: string;
// For bank transfer
bankDetails?: {
bankName: string;
accountNumber: string;
bik: string;
purpose: string;
};
expiresAt: string;
};
summary: {
subtotal: number;
discount: number;
shipping: number;
tax: number;
total: number;
};
estimatedDelivery: string | null;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid input data |
| 400 | CART_EMPTY | Cart is empty |
| 400 | ITEMS_UNAVAILABLE | Some items are no longer available |
| 400 | INSUFFICIENT_STOCK | Not enough stock for some items |
| 400 | INVALID_ADDRESS | Shipping address is invalid |
| 400 | INVALID_SHIPPING_METHOD | Shipping method not available |
| 400 | INVALID_COUPON | Coupon code is invalid or expired |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 403 | KYC_REQUIRED | KYC verification required for this purchase |
| 429 | RATE_LIMIT_EXCEEDED | Too many checkout attempts |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/cart/checkout \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"shippingAddressId": "aa0e8400-e29b-41d4-a716-446655440000",
"shippingMethodId": "ship-001",
"paymentMethod": "CARD",
"couponCodes": ["WELCOME10"]
}'Response:
{
"success": true,
"data": {
"orderId": "or0e8400-e29b-41d4-a716-446655440001",
"orderNumber": "ORD-2024-00001234",
"status": "PENDING_PAYMENT",
"payment": {
"method": "CARD",
"amount": 8100,
"currency": "RUB",
"paymentUrl": "https://payment.iwm-platform.com/pay/abc123",
"expiresAt": "2024-01-15T22:00:00Z"
},
"summary": {
"subtotal": 7500,
"discount": 750,
"shipping": 350,
"tax": 1000,
"total": 8100
},
"estimatedDelivery": "2024-01-20"
}
}Order Endpoints
GET /api/v1/orders
List orders.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number (optional) |
| pageSize | number | Items per page, max 50 (optional) |
| status | string | Filter by status (optional) |
| dateFrom | string | Start date (ISO 8601) (optional) |
| dateTo | string | End date (ISO 8601) (optional) |
Response (200 OK)
interface OrdersResponse {
orders: OrderSummary[];
}
interface OrderSummary {
id: string;
orderNumber: string;
status: 'PENDING_PAYMENT' | 'PAID' | 'PROCESSING' | 'SHIPPED' | 'DELIVERED' | 'CANCELLED' | 'REFUNDED';
paymentStatus: 'PENDING' | 'PAID' | 'FAILED' | 'REFUNDED';
itemCount: number;
total: number;
currency: string;
createdAt: string;
updatedAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid query parameters |
| 401 | UNAUTHORIZED | Invalid or expired access token |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/orders?status=DELIVERED&page=1&pageSize=10" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"orders": [
{
"id": "or0e8400-e29b-41d4-a716-446655440001",
"orderNumber": "ORD-2024-00001234",
"status": "DELIVERED",
"paymentStatus": "PAID",
"itemCount": 3,
"total": 8100,
"currency": "RUB",
"createdAt": "2024-01-10T14:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
]
},
"meta": {
"pagination": {
"total": 15,
"page": 1,
"pageSize": 10,
"totalPages": 2,
"hasNext": true,
"hasPrevious": false
}
}
}GET /api/v1/orders/:id
Get order details.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Order ID |
Request Body
None
Query Parameters
None
Response (200 OK)
interface OrderDetailResponse {
id: string;
orderNumber: string;
status: string;
paymentStatus: string;
items: {
id: string;
product: {
id: string;
name: string;
sku: string;
thumbnailUrl: string | null;
};
variantId: string | null;
variantAttributes: Record<string, string> | null;
quantity: number;
unitPrice: number;
totalPrice: number;
}[];
pricing: {
subtotal: number;
discount: number;
shipping: number;
tax: number;
total: number;
currency: string;
};
shippingAddress: {
recipientName: string;
street: string;
city: string;
region: string;
country: string;
postalCode: string;
phone: string | null;
};
billingAddress: {
street: string;
city: string;
region: string;
country: string;
postalCode: string;
} | null;
shippingMethod: {
name: string;
carrier: string | null;
estimatedDelivery: string | null;
};
payment: {
method: string;
transactionId: string | null;
paidAt: string | null;
};
appliedCoupons: {
code: string;
discount: number;
}[];
notes: string | null;
statusHistory: {
status: string;
changedAt: string;
note: string | null;
}[];
canCancel: boolean;
canRefund: boolean;
createdAt: string;
updatedAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | ORDER_NOT_FOUND | Order not found |
Example
Request:
curl -X GET https://api.iwm-platform.com/api/v1/orders/or0e8400-e29b-41d4-a716-446655440001 \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"id": "or0e8400-e29b-41d4-a716-446655440001",
"orderNumber": "ORD-2024-00001234",
"status": "DELIVERED",
"paymentStatus": "PAID",
"items": [
{
"id": "oi0e8400-e29b-41d4-a716-446655440001",
"product": {
"id": "pp0e8400-e29b-41d4-a716-446655440001",
"name": "Premium Health Supplement",
"sku": "SUP-001",
"thumbnailUrl": "https://cdn.iwm-platform.com/products/sup-001-thumb.jpg"
},
"variantId": null,
"variantAttributes": null,
"quantity": 3,
"unitPrice": 2500,
"totalPrice": 7500
}
],
"pricing": {
"subtotal": 7500,
"discount": 750,
"shipping": 350,
"tax": 1000,
"total": 8100,
"currency": "RUB"
},
"shippingAddress": {
"recipientName": "John Doe",
"street": "Tverskaya 15, apt. 42",
"city": "Moscow",
"region": "Moscow Oblast",
"country": "RU",
"postalCode": "125009",
"phone": "+79991234567"
},
"billingAddress": null,
"shippingMethod": {
"name": "Standard Delivery",
"carrier": "Russian Post",
"estimatedDelivery": "2024-01-20"
},
"payment": {
"method": "CARD",
"transactionId": "TXN-2024011500001",
"paidAt": "2024-01-10T14:05:00Z"
},
"appliedCoupons": [
{
"code": "WELCOME10",
"discount": 750
}
],
"notes": null,
"statusHistory": [
{ "status": "PENDING_PAYMENT", "changedAt": "2024-01-10T14:00:00Z", "note": null },
{ "status": "PAID", "changedAt": "2024-01-10T14:05:00Z", "note": "Payment confirmed" },
{ "status": "PROCESSING", "changedAt": "2024-01-11T09:00:00Z", "note": null },
{ "status": "SHIPPED", "changedAt": "2024-01-12T15:00:00Z", "note": "Tracking: RP123456789RU" },
{ "status": "DELIVERED", "changedAt": "2024-01-15T10:00:00Z", "note": null }
],
"canCancel": false,
"canRefund": true,
"createdAt": "2024-01-10T14:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}GET /api/v1/orders/:id/tracking
Get tracking information.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Order ID |
Request Body
None
Query Parameters
None
Response (200 OK)
interface TrackingResponse {
orderId: string;
orderNumber: string;
status: string;
carrier: string | null;
trackingNumber: string | null;
trackingUrl: string | null;
estimatedDelivery: string | null;
events: {
status: string;
location: string | null;
description: string;
timestamp: string;
}[];
shippedAt: string | null;
deliveredAt: string | null;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | ORDER_NOT_FOUND | Order not found |
| 400 | NOT_SHIPPED | Order has not been shipped yet |
Example
Request:
curl -X GET https://api.iwm-platform.com/api/v1/orders/or0e8400-e29b-41d4-a716-446655440001/tracking \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Response:
{
"success": true,
"data": {
"orderId": "or0e8400-e29b-41d4-a716-446655440001",
"orderNumber": "ORD-2024-00001234",
"status": "DELIVERED",
"carrier": "Russian Post",
"trackingNumber": "RP123456789RU",
"trackingUrl": "https://pochta.ru/tracking#RP123456789RU",
"estimatedDelivery": "2024-01-20",
"events": [
{
"status": "DELIVERED",
"location": "Moscow",
"description": "Package delivered",
"timestamp": "2024-01-15T10:00:00Z"
},
{
"status": "OUT_FOR_DELIVERY",
"location": "Moscow",
"description": "Out for delivery",
"timestamp": "2024-01-15T08:00:00Z"
},
{
"status": "IN_TRANSIT",
"location": "Moscow Sorting Center",
"description": "Arrived at sorting center",
"timestamp": "2024-01-14T16:00:00Z"
},
{
"status": "SHIPPED",
"location": "Warehouse",
"description": "Package shipped",
"timestamp": "2024-01-12T15:00:00Z"
}
],
"shippedAt": "2024-01-12T15:00:00Z",
"deliveredAt": "2024-01-15T10:00:00Z"
}
}POST /api/v1/orders/:id/cancel
Cancel order.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Order ID |
Request Body
interface CancelOrderRequest {
reason: string; // Cancellation reason
}Query Parameters
None
Response (200 OK)
interface CancelOrderResponse {
orderId: string;
orderNumber: string;
status: 'CANCELLED';
refundStatus: 'PENDING' | 'PROCESSING' | 'COMPLETED' | null;
refundAmount: number | null;
message: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Reason not provided |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | ORDER_NOT_FOUND | Order not found |
| 400 | CANNOT_CANCEL | Order cannot be cancelled (already shipped/delivered) |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/orders/or0e8400-e29b-41d4-a716-446655440002/cancel \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"reason": "Changed my mind"
}'Response:
{
"success": true,
"data": {
"orderId": "or0e8400-e29b-41d4-a716-446655440002",
"orderNumber": "ORD-2024-00001235",
"status": "CANCELLED",
"refundStatus": "PENDING",
"refundAmount": 5000,
"message": "Order cancelled successfully. Refund will be processed within 3-5 business days."
}
}POST /api/v1/orders/:id/refund
Request refund.
Authentication: Required
Rate Limit: 100 requests per minute
Request Headers
Authorization: Bearer <access_token>Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string (UUID) | Order ID |
Request Body
interface RefundRequest {
reason: string; // Refund reason
itemIds?: string[]; // Specific item IDs to refund (optional, all if not specified)
description?: string; // Additional description
}Query Parameters
None
Response (201 Created)
interface RefundResponse {
refundRequestId: string;
orderId: string;
orderNumber: string;
status: 'PENDING_REVIEW';
requestedAmount: number;
items: {
itemId: string;
productName: string;
quantity: number;
amount: number;
}[];
message: string;
createdAt: string;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid input data |
| 401 | UNAUTHORIZED | Invalid or expired access token |
| 404 | ORDER_NOT_FOUND | Order not found |
| 400 | CANNOT_REFUND | Order is not eligible for refund |
| 400 | REFUND_PERIOD_EXPIRED | Refund period has expired |
| 409 | REFUND_ALREADY_REQUESTED | Refund request already pending |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/orders/or0e8400-e29b-41d4-a716-446655440001/refund \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"reason": "Product defective",
"description": "The supplement bottle cap was damaged on arrival"
}'Response:
{
"success": true,
"data": {
"refundRequestId": "rf0e8400-e29b-41d4-a716-446655440001",
"orderId": "or0e8400-e29b-41d4-a716-446655440001",
"orderNumber": "ORD-2024-00001234",
"status": "PENDING_REVIEW",
"requestedAmount": 8100,
"items": [
{
"itemId": "oi0e8400-e29b-41d4-a716-446655440001",
"productName": "Premium Health Supplement",
"quantity": 3,
"amount": 7500
}
],
"message": "Refund request submitted. You will be notified once reviewed.",
"createdAt": "2024-01-15T21:00:00Z"
}
}Shipping Endpoints
GET /api/v1/shipping/methods
Get available shipping methods.
Authentication: Optional
Rate Limit: 200 requests per minute
Request Headers
Authorization: Bearer <access_token> (optional)Request Body
None
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| country | string | Destination country code (ISO 3166-1 alpha-2) |
| postalCode | string | Destination postal code (optional) |
| cartId | string | Cart ID for accurate calculation (optional) |
Response (200 OK)
interface ShippingMethodsResponse {
methods: ShippingMethod[];
}
interface ShippingMethod {
id: string;
name: string;
carrier: string;
description: string | null;
estimatedDays: {
min: number;
max: number;
};
price: number;
currency: string;
isFree: boolean;
freeThreshold: number | null;
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid country code |
| 400 | SHIPPING_NOT_AVAILABLE | No shipping available to this location |
Example
Request:
curl -X GET "https://api.iwm-platform.com/api/v1/shipping/methods?country=RU&postalCode=125009"Response:
{
"success": true,
"data": {
"methods": [
{
"id": "ship-001",
"name": "Standard Delivery",
"carrier": "Russian Post",
"description": "Delivered to your nearest post office",
"estimatedDays": {
"min": 5,
"max": 10
},
"price": 350,
"currency": "RUB",
"isFree": false,
"freeThreshold": 5000
},
{
"id": "ship-002",
"name": "Express Delivery",
"carrier": "CDEK",
"description": "Fast delivery to your door",
"estimatedDays": {
"min": 2,
"max": 4
},
"price": 650,
"currency": "RUB",
"isFree": false,
"freeThreshold": 10000
}
]
}
}POST /api/v1/shipping/calculate
Calculate shipping cost.
Authentication: Optional
Rate Limit: 200 requests per minute
Request Headers
Authorization: Bearer <access_token> (optional)Request Body
interface CalculateShippingRequest {
destination: {
country: string; // ISO 3166-1 alpha-2
region?: string;
city?: string;
postalCode: string;
};
items: {
productId: string;
quantity: number;
variantId?: string;
}[];
// OR
cartId?: string; // Use current cart items
}Query Parameters
None
Response (200 OK)
interface CalculateShippingResponse {
destination: {
country: string;
postalCode: string;
};
package: {
totalWeight: number;
dimensions: {
length: number;
width: number;
height: number;
};
};
options: {
methodId: string;
name: string;
carrier: string;
price: number;
currency: string;
estimatedDelivery: {
min: string; // ISO 8601 date
max: string; // ISO 8601 date
};
isFree: boolean;
}[];
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid input data |
| 400 | INVALID_DESTINATION | Cannot ship to this destination |
| 404 | PRODUCT_NOT_FOUND | One or more products not found |
Example
Request:
curl -X POST https://api.iwm-platform.com/api/v1/shipping/calculate \
-H "Content-Type: application/json" \
-d '{
"destination": {
"country": "RU",
"postalCode": "125009"
},
"items": [
{
"productId": "pp0e8400-e29b-41d4-a716-446655440001",
"quantity": 3
}
]
}'Response:
{
"success": true,
"data": {
"destination": {
"country": "RU",
"postalCode": "125009"
},
"package": {
"totalWeight": 750,
"dimensions": {
"length": 25,
"width": 15,
"height": 20
}
},
"options": [
{
"methodId": "ship-001",
"name": "Standard Delivery",
"carrier": "Russian Post",
"price": 350,
"currency": "RUB",
"estimatedDelivery": {
"min": "2024-01-20",
"max": "2024-01-25"
},
"isFree": false
},
{
"methodId": "ship-002",
"name": "Express Delivery",
"carrier": "CDEK",
"price": 650,
"currency": "RUB",
"estimatedDelivery": {
"min": "2024-01-17",
"max": "2024-01-19"
},
"isFree": false
}
]
}
}