{
	"info": {
		"_postman_id": "oem-reporting-api-v1",
		"name": "OEM Reporting API V1",
		"description": "Sahaj Mobile OEM Reporting API for partners to retrieve their customer/loan data.\n\n## Authentication\nUse `X-API-Key` header with your assigned API key.\n\n## Available API Keys (Examples)\n- Samsung: `sk_live_samsung_0266c01d99d01061dd849d3b13faa5f7`\n- Walton: `sk_live_walton_856e9031dc2dc9087bc3f4c2a423d6ce`\n- Honor: `sk_live_honor_8134ba7ebe51ee47034fc93dbf288ef1`\n- Xiaomi: `sk_live_xiaomi_15809c0e7fb193685a1cd3ab0bd57ef9`\n- OnePlus: `sk_live_oneplus_a62fa7684ff3f0103318e3ad0266dabd`\n- Oppo RBS: `sk_live_opporbs_97294885a9a57a37fdfec5e8a4778b8b`\n- Oppo OEM: `sk_live_oppooem_6776a411d4d07aa000c304cb177b793d`\n- Vivo RBS: `sk_live_vivorbs_d9cf3c0f0040122bad87c3077d34edcb`\n\n## Response Fields\n- **Unique ID**: Only for Samsung - extracted from shop name after last dash (e.g., KULD000654)\n- **Loan Tenure**: Calculated as 3/6/9/12 Month based on installments",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "https://sahajmobile.org/API/Reporting/V1/Api",
			"type": "string"
		},
		{
			"key": "api_key",
			"value": "sk_live_samsung_0266c01d99d01061dd849d3b13faa5f7",
			"type": "string"
		}
	],
	"item": [
		{
			"name": "Documentation",
			"item": [
				{
					"name": "API Documentation",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}",
							"host": ["{{base_url}}"]
						},
						"description": "Get API documentation and available endpoints. No authentication required."
					},
					"response": []
				}
			]
		},
		{
			"name": "OEM Info",
			"item": [
				{
					"name": "Get OEM Info",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/info",
							"host": ["{{base_url}}"],
							"path": ["info"]
						},
						"description": "Get information about the authenticated OEM including:\n- OEM name\n- Connected units\n- Total shops\n- Total customers"
					},
					"response": []
				}
			]
		},
		{
			"name": "Customers",
			"item": [
				{
					"name": "Get All Customers",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "per_page",
									"value": "100",
									"description": "Items per page (default: 100, max: 1000)"
								}
							]
						},
						"description": "Get customer/loan data with pagination.\n\n**Response Fields:**\n- sl: Serial number\n- loan_origination_date: Date when loan was originated\n- emi_scheme: Monthly or Weekly\n- loan_tenure: 3 Month / 6 Month / 9 Month / 12 Month\n- shop_type: OEM/Unit name\n- shop_name: Shop/Retailer name\n- shop_area: Shop location/area\n- unique_id: Samsung Unique ID (null for other brands)\n- device_brand: Device brand name\n- device_model: Device model name\n- device_cost: Device regular rate/cost\n- retail_price: Sales rate/retail price\n- loan_advance: Booking money/advance\n- down_payment_amount: Down payment amount\n- down_payment_percent: Down payment percentage\n- device_imei: Device IMEI number"
					},
					"response": []
				},
				{
					"name": "Get Customers with Date Filter",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100&from_date=2026-01-01&to_date=2026-04-09",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "from_date",
									"value": "2026-01-01",
									"description": "Filter by origination date from (YYYY-MM-DD)"
								},
								{
									"key": "to_date",
									"value": "2026-04-09",
									"description": "Filter by origination date to (YYYY-MM-DD)"
								}
							]
						},
						"description": "Get customers filtered by date range"
					},
					"response": []
				},
				{
					"name": "Get Customers by Shop",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100&shop_id=123",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "shop_id",
									"value": "123",
									"description": "Filter by specific shop ID"
								}
							]
						},
						"description": "Get customers filtered by shop ID"
					},
					"response": []
				},
				{
					"name": "Get Customers by Brand",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100&brand=Samsung",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "brand",
									"value": "Samsung",
									"description": "Filter by device brand"
								}
							]
						},
						"description": "Get customers filtered by device brand"
					},
					"response": []
				},
				{
					"name": "Get Active Customers Only",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100&status=1",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "status",
									"value": "1",
									"description": "Filter by status (1=Active, 0=Inactive)"
								}
							]
						},
						"description": "Get only active customers"
					},
					"response": []
				},
				{
					"name": "Get Customers - All Filters",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/customers?page=1&per_page=100&from_date=2026-01-01&to_date=2026-04-09&brand=Samsung&status=1",
							"host": ["{{base_url}}"],
							"path": ["customers"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "from_date",
									"value": "2026-01-01"
								},
								{
									"key": "to_date",
									"value": "2026-04-09"
								},
								{
									"key": "brand",
									"value": "Samsung"
								},
								{
									"key": "status",
									"value": "1"
								}
							]
						},
						"description": "Get customers with all filters applied"
					},
					"response": []
				}
			]
		},
		{
			"name": "Dashboard",
			"item": [
				{
					"name": "Get Dashboard Summary",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/dashboard",
							"host": ["{{base_url}}"],
							"path": ["dashboard"]
						},
						"description": "Get dashboard summary counts including:\n- Total customers\n- Total shops\n- Total units\n- Total device cost\n- Total retail price\n- Total loan advance\n- Total down payment\n- Breakdown by EMI scheme (Weekly/Monthly)\n- Breakdown by loan tenure\n- Breakdown by device brand\n- Top 10 shops by customer count\n- Monthly origination trend"
					},
					"response": []
				},
				{
					"name": "Get Dashboard with Date Filter",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/dashboard?from_date=2026-01-01&to_date=2026-04-09",
							"host": ["{{base_url}}"],
							"path": ["dashboard"],
							"query": [
								{
									"key": "from_date",
									"value": "2026-01-01",
									"description": "Filter by origination date from (YYYY-MM-DD)"
								},
								{
									"key": "to_date",
									"value": "2026-04-09",
									"description": "Filter by origination date to (YYYY-MM-DD)"
								}
							]
						},
						"description": "Get dashboard summary filtered by date range"
					},
					"response": []
				}
			]
		},
		{
			"name": "Shops",
			"item": [
				{
					"name": "Get All Shops",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/shops?page=1&per_page=100",
							"host": ["{{base_url}}"],
							"path": ["shops"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "per_page",
									"value": "100",
									"description": "Items per page (default: 100, max: 500)"
								}
							]
						},
						"description": "Get list of shops for the authenticated OEM including:\n- shop_id\n- shop_name\n- shop_area\n- shop_mobile\n- shop_type\n- customer_count"
					},
					"response": []
				}
			]
		},
		{
			"name": "Brands",
			"item": [
				{
					"name": "Get All Brands",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/brands?page=1&per_page=100",
							"host": ["{{base_url}}"],
							"path": ["brands"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "per_page",
									"value": "100",
									"description": "Items per page (default: 100, max: 500)"
								}
							]
						},
						"description": "Get list of device brands for the authenticated OEM including:\n- brand_name: Device brand name\n- customer_count: Number of customers with this brand\n- total_sales: Total sales amount for this brand"
					},
					"response": []
				},
				{
					"name": "Search Brands",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/brands?page=1&per_page=100&search=Samsung",
							"host": ["{{base_url}}"],
							"path": ["brands"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "search",
									"value": "Samsung",
									"description": "Search brand name"
								}
							]
						},
						"description": "Search brands by name"
					},
					"response": []
				}
			]
		},
		{
			"name": "Models",
			"item": [
				{
					"name": "Get All Models",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/models?page=1&per_page=100",
							"host": ["{{base_url}}"],
							"path": ["models"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "per_page",
									"value": "100",
									"description": "Items per page (default: 100, max: 500)"
								}
							]
						},
						"description": "Get list of device models for the authenticated OEM including:\n- brand_name: Device brand name\n- model_name: Device model name\n- customer_count: Number of customers with this model\n- total_sales: Total sales amount for this model\n- avg_device_cost: Average device cost\n- avg_retail_price: Average retail price"
					},
					"response": []
				},
				{
					"name": "Get Models by Brand",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/models?page=1&per_page=100&brand=Samsung",
							"host": ["{{base_url}}"],
							"path": ["models"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "brand",
									"value": "Samsung",
									"description": "Filter by brand name"
								}
							]
						},
						"description": "Get models filtered by brand name"
					},
					"response": []
				},
				{
					"name": "Search Models",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/models?page=1&per_page=100&search=Galaxy",
							"host": ["{{base_url}}"],
							"path": ["models"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "search",
									"value": "Galaxy",
									"description": "Search model name"
								}
							]
						},
						"description": "Search models by name"
					},
					"response": []
				},
				{
					"name": "Get Models - All Filters",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/models?page=1&per_page=100&brand=Samsung&search=A15",
							"host": ["{{base_url}}"],
							"path": ["models"],
							"query": [
								{
									"key": "page",
									"value": "1"
								},
								{
									"key": "per_page",
									"value": "100"
								},
								{
									"key": "brand",
									"value": "Samsung",
									"description": "Filter by brand name"
								},
								{
									"key": "search",
									"value": "A15",
									"description": "Search model name"
								}
							]
						},
						"description": "Get models with brand and search filters"
					},
					"response": []
				}
			]
		},
		{
			"name": "Export",
			"item": [
				{
					"name": "Export Data to Azure",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/export",
							"host": ["{{base_url}}"],
							"path": ["export"]
						},
						"description": "Export all customer/loan data to Azure Blob Storage as CSV.\n\n**Response Fields:**\n- filename: Generated CSV filename\n- url: Azure Blob URL to download the file (SAS signed)\n- size: File size in bytes\n- size_formatted: Human readable file size\n- rows: Number of records exported\n- exported_at: Export timestamp\n- expires_at: When the file will be auto-deleted\n\n**Retention Policy:**\n- Exports are automatically deleted after 24 hours\n- Download the file promptly after export"
					},
					"response": []
				},
				{
					"name": "Export with Date Filter",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/export?from_date=2026-01-01&to_date=2026-04-09",
							"host": ["{{base_url}}"],
							"path": ["export"],
							"query": [
								{
									"key": "from_date",
									"value": "2026-01-01",
									"description": "Filter by origination date from (YYYY-MM-DD)"
								},
								{
									"key": "to_date",
									"value": "2026-04-09",
									"description": "Filter by origination date to (YYYY-MM-DD)"
								}
							]
						},
						"description": "Export customer data filtered by date range"
					},
					"response": []
				},
				{
					"name": "Export with All Filters",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/export?from_date=2026-01-01&to_date=2026-04-09&brand=Samsung&status=1",
							"host": ["{{base_url}}"],
							"path": ["export"],
							"query": [
								{
									"key": "from_date",
									"value": "2026-01-01",
									"description": "Filter by origination date from"
								},
								{
									"key": "to_date",
									"value": "2026-04-09",
									"description": "Filter by origination date to"
								},
								{
									"key": "brand",
									"value": "Samsung",
									"description": "Filter by device brand"
								},
								{
									"key": "status",
									"value": "1",
									"description": "Filter by status (1=Active, 0=Inactive)"
								}
							]
						},
						"description": "Export customer data with all filters applied"
					},
					"response": []
				},
				{
					"name": "List Exports",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "X-API-Key",
								"value": "{{api_key}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/exports?page=1&per_page=20",
							"host": ["{{base_url}}"],
							"path": ["exports"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "per_page",
									"value": "20",
									"description": "Items per page (default: 20, max: 100)"
								}
							]
						},
						"description": "List all exported files in Azure for this OEM with pagination.\n\n**Query Parameters:**\n- page: Page number (default: 1)\n- per_page: Items per page (default: 20, max: 100)\n\n**Response Fields:**\n- name: Blob filename\n- url: Download URL (SAS signed, valid 24hrs)\n- size: File size in bytes\n- size_formatted: Human readable file size\n- last_modified: Last modified date\n\n**Pagination:**\n- current_page: Current page number\n- per_page: Items per page\n- total: Total number of exports\n- total_pages: Total number of pages\n- has_more: Boolean if more pages exist\n\n**Retention Policy:**\n- Exports are automatically deleted after 24 hours\n- The response includes a `retention` object showing policy details and count of files deleted"
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "apikey",
		"apikey": [
			{
				"key": "key",
				"value": "X-API-Key",
				"type": "string"
			},
			{
				"key": "value",
				"value": "{{api_key}}",
				"type": "string"
			},
			{
				"key": "in",
				"value": "header",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					"pm.test(\"Status code is 200\", function () {",
					"    pm.response.to.have.status(200);",
					"});",
					"",
					"pm.test(\"Response is JSON\", function () {",
					"    pm.response.to.be.json;",
					"});",
					"",
					"pm.test(\"Response has success field\", function () {",
					"    var jsonData = pm.response.json();",
					"    pm.expect(jsonData).to.have.property('success');",
					"});"
				]
			}
		}
	]
}
