{
	"info": {
		"_postman_id": "b5a9c4d2-1e8f-4a3b-9c5d-6e7f8a9b0c1d",
		"name": "ProxyRotator API",
		"description": "Postman collection for ProxyRotator API",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "System",
			"item": [
				{
					"name": "Health Check",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/health",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"health"
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Stats",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/stats",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"stats"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Import",
			"item": [
				{
					"name": "Import Text",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"group\": \"default\",\n    \"tags\": [\"datacenter\", \"fast\"],\n    \"protocol_hint\": \"http\",\n    \"text\": \"127.0.0.1:8080\n192.168.1.1:3128:user:pass\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/import/text",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"import",
								"text"
							]
						}
					},
					"response": []
				},
				{
					"name": "Import File",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "file",
									"type": "file",
									"src": []
								},
								{
									"key": "group",
									"value": "default",
									"type": "text"
								},
								{
									"key": "tags",
									"value": "source_a,imported",
									"type": "text"
								},
								{
									"key": "protocol_hint",
									"value": "http",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/import/file",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"import",
								"file"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Proxies",
			"item": [
				{
					"name": "List Proxies",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/proxies?offset=0&limit=20",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies"
							],
							"query": [
								{
									"key": "offset",
									"value": "0"
								},
								{
									"key": "limit",
									"value": "20"
								},
								{
									"key": "group",
									"value": "default",
									"disabled": true
								},
								{
									"key": "status",
									"value": "alive,unknown",
									"disabled": true
								},
								{
									"key": "tags",
									"value": "fast,datacenter",
									"disabled": true
								},
								{
									"key": "only_enabled",
									"value": "true",
									"disabled": true
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Proxy",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/{{proxyId}}",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"{{proxyId}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Update Proxy",
					"request": {
						"method": "PATCH",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"group\": \"premium\",\n    \"add_tags\": [\"verified\"],\n    \"disabled\": false\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/{{proxyId}}",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"{{proxyId}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Delete Proxy",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/{{proxyId}}",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"{{proxyId}}"
							]
						}
					},
					"response": []
				},
				{
					"name": "Bulk Delete Proxies",
					"request": {
						"method": "DELETE",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"status\": \"dead\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies"
							]
						},
						"description": "Bulk delete proxies by condition. Options:\n- ids: array of proxy IDs\n- status: \"dead\", \"alive\", \"unknown\"\n- group: group name\n- disabled: true/false"
					},
					"response": []
				}
			]
		},
		{
			"name": "Testing",
			"item": [
				{
					"name": "Test Proxies (Batch)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"group\": \"default\",\n    \"filter\": {\n        \"status\": [\"unknown\", \"alive\"],\n        \"limit\": 100\n    },\n    \"test_spec\": {\n        \"url\": \"http://httpbin.org/ip\",\n        \"method\": \"GET\",\n        \"timeout_ms\": 5000,\n        \"expect_status\": [200]\n    },\n    \"concurrency\": 20,\n    \"update_store\": true,\n    \"write_log\": true\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/test",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"test"
							]
						}
					},
					"response": []
				},
				{
					"name": "Test Single Proxy",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"url\": \"http://httpbin.org/ip\",\n    \"method\": \"GET\",\n    \"timeout_ms\": 5000,\n    \"expect_status\": [200],\n    \"update_store\": true,\n    \"write_log\": true\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/{{proxyId}}/test",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"{{proxyId}}",
								"test"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Telegram",
			"item": [
				{
					"name": "Get Config",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/telegram/config",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"telegram",
								"config"
							]
						}
					},
					"response": []
				},
				{
					"name": "Update Config",
					"request": {
						"method": "PUT",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"enabled\": true,\n    \"bot_token\": \"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\",\n    \"admin_ids\": [123456789],\n    \"notify_chat_id\": \"-1001234567890\",\n    \"test_interval_minutes\": 60,\n    \"alert_threshold_percent\": 50,\n    \"test_url\": \"https://httpbin.org/ip\",\n    \"test_timeout_ms\": 5000\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/telegram/config",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"telegram",
								"config"
							]
						}
					},
					"response": []
				},
				{
					"name": "Test Connection",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"token\": \"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/telegram/test",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"telegram",
								"test"
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Status",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/telegram/status",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"telegram",
								"status"
							]
						}
					},
					"response": []
				},
				{
					"name": "Trigger Test",
					"request": {
						"method": "POST",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/telegram/trigger-test",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"telegram",
								"trigger-test"
							]
						},
						"description": "Manually trigger proxy health check"
					},
					"response": []
				}
			]
		},
		{
			"name": "Selection",
			"item": [
				{
					"name": "Get Next Proxy",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/next?group=default&policy=random",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"next"
							],
							"query": [
								{
									"key": "group",
									"value": "default"
								},
								{
									"key": "site",
									"value": "",
									"disabled": true
								},
								{
									"key": "policy",
									"value": "random",
									"description": "round_robin, random, weighted"
								},
								{
									"key": "tags_any",
									"value": "fast",
									"disabled": true
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Report Status",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"lease_id\": \"{{leaseId}}\",\n    \"proxy_id\": \"{{proxyId}}\",\n    \"success\": true,\n    \"latency_ms\": 150\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/v1/proxies/report",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"v1",
								"proxies",
								"report"
							]
						}
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "apikey",
		"apikey": [
			{
				"key": "value",
				"value": "{{apiKey}}",
				"type": "string"
			},
			{
				"key": "key",
				"value": "X-API-Key",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "baseUrl",
			"value": "http://localhost:8080",
			"type": "string"
		},
		{
			"key": "apiKey",
			"value": "",
			"type": "string"
		},
		{
			"key": "leaseId",
			"value": "",
			"type": "string"
		},
		{
			"key": "proxyId",
			"value": "",
			"type": "string"
		}
	]
}
