List Products
Retrieve a paginated list of products with optional filtering and sorting.
GET
https://api.zenpayz.com/merchant/api/v1/productsBearer · API key
Request
Headers
| Header | Description |
|---|---|
Authorization REQUIRED | Bearer {api_key} |
X-Signature REQUIRED | HMAC-SHA256 signature |
X-Timestamp REQUIRED | ISO 8601 timestamp |
X-Secret-Salt REQUIRED | Secret salt for HMAC validation |
Content-Type REQUIRED | application/json |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
status OPTIONAL | string | Filter by status: ACTIVE, INACTIVE, ARCHIVED |
currency OPTIONAL | string | Filter by currency code |
categoryId OPTIONAL | number | Filter by category ID |
page OPTIONAL | number | Page number (default: 1) |
limit OPTIONAL | number | Items per page (default: 20, max: 100) |
sortBy OPTIONAL | string | Sort field (default: createdAt) |
sortOrder OPTIONAL | string | Sort direction: ASC or DESC (default: DESC) |
searchTerm OPTIONAL | string | Search by product name or SKU |
Response
Success (200 OK)
{
"success": true,
"data": {
"items": [
{
"productId": "prod_a1b2c3d4e5f6g7h8",
"name": "Pro Plan",
"description": "Professional subscription plan with advanced features",
"price": 4999,
"currency": "INR",
"sku": "PRO-PLAN-001",
"status": "ACTIVE",
"categoryId": 1,
"images": [
{
"url": "https://example.com/images/pro-plan.png",
"alt": "Pro Plan",
"isPrimary": true
}
],
"pricingTiers": [],
"metadata": {},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 20,
"totalPages": 1
},
"message": "Products retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 35,
"api_version": "v1",
"endpoint": "GET /products",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| VALIDATION_ERROR | 400 | Invalid query parameters |
| UNAUTHORIZED | 401 | Invalid API key |
Examples
- cURL
- JavaScript
- SDK
curl -X GET "https://api.zenpayz.com/merchant/api/v1/products?status=ACTIVE&page=1&limit=20" \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json"
const params = new URLSearchParams({
status: 'ACTIVE',
page: '1',
limit: '20',
});
const response = await fetch(`https://api.zenpayz.com/merchant/api/v1/products?${params}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'Content-Type': 'application/json',
},
});
const result = await response.json();
console.log(result.data.items); // Array of products
console.log(result.data.total); // Total count
const products = await zenpays.products.list({
status: 'ACTIVE',
page: 1,
limit: 20,
});
console.log(products.items); // Array of products
console.log(products.total); // Total count