{
  "info": {
    "name": "Fast AFF API",
    "description": "Tạo ảnh qua Google Labs Flow với multi-account, captcha-server, proxy xoay (ShopLike). Set the {{baseUrl}} and {{apiKey}} variables before running.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:5000",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "test-key-12345",
      "type": "string"
    },
    {
      "key": "profileId",
      "value": "",
      "type": "string",
      "description": "Set after creating a profile"
    },
    {
      "key": "jobId",
      "value": "",
      "type": "string",
      "description": "Set after generating an image"
    }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-Key", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "item": [
    {
      "name": "Health (no auth)",
      "request": {
        "method": "GET",
        "url": { "raw": "{{baseUrl}}/health", "host": ["{{baseUrl}}"], "path": ["health"] },
        "auth": { "type": "noauth" }
      }
    },
    {
      "name": "Profiles",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/profiles", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles"] }
          }
        },
        {
          "name": "Get by id",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/profiles/{{profileId}}", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles","{{profileId}}"] }
          }
        },
        {
          "name": "Create",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/profiles", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"acc-01\",\n  \"email\": \"x@gmail.com\",\n  \"projectId\": \"40020ed1-3b52-47ec-9e9a-4c503dd35f0b\",\n  \"bearerToken\": \"ya29.PASTE_BEARER_HERE\",\n  \"proxyRotationKey\": \"\",\n  \"proxy\": \"\",\n  \"captchaServerUrl\": \"\",\n  \"tags\": [\"vip\", \"batch-a\"]\n}"
            }
          }
        },
        {
          "name": "Update (PATCH)",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/profiles/{{profileId}}", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles","{{profileId}}"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"bearerToken\": \"ya29.NEW_TOKEN\",\n  \"proxy\": \"\",\n  \"tags\": [\"vip\", \"us\"]\n}"
            }
          }
        },
        {
          "name": "Delete",
          "request": {
            "method": "DELETE",
            "url": { "raw": "{{baseUrl}}/api/v1/profiles/{{profileId}}", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles","{{profileId}}"] }
          }
        },
        {
          "name": "Rotate proxy (ShopLike)",
          "request": {
            "method": "POST",
            "url": { "raw": "{{baseUrl}}/api/v1/profiles/{{profileId}}/rotate-proxy", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles","{{profileId}}","rotate-proxy"] }
          }
        },
        {
          "name": "Bulk tags (add/remove)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/profiles/bulk-tags", "host": ["{{baseUrl}}"], "path": ["api","v1","profiles","bulk-tags"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"ids\": [\"{{profileId}}\"],\n  \"add\": [\"batch-b\"],\n  \"remove\": [\"batch-a\"]\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Images",
      "item": [
        {
          "name": "Generate (count 1-4)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/images", "host": ["{{baseUrl}}"], "path": ["api","v1","images"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"prompt\": \"a red apple on wooden table\",\n  \"aspectRatio\": \"IMAGE_ASPECT_RATIO_LANDSCAPE\",\n  \"model\": \"GEM_PIX_2\",\n  \"count\": 1,\n  \"parallel\": false\n}"
            }
          }
        },
        {
          "name": "List recent",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/v1/images?limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["api","v1","images"],
              "query": [{ "key": "limit", "value": "20" }]
            }
          }
        },
        {
          "name": "Get by jobId",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/images/{{jobId}}", "host": ["{{baseUrl}}"], "path": ["api","v1","images","{{jobId}}"] }
          }
        },
        {
          "name": "Download PNG",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/images/{{jobId}}/file", "host": ["{{baseUrl}}"], "path": ["api","v1","images","{{jobId}}","file"] }
          }
        }
      ]
    },
    {
      "name": "Settings",
      "item": [
        {
          "name": "Get captcha config",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/settings/captcha", "host": ["{{baseUrl}}"], "path": ["api","v1","settings","captcha"] }
          }
        },
        {
          "name": "Put captcha config",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/settings/captcha", "host": ["{{baseUrl}}"], "path": ["api","v1","settings","captcha"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"siteKey\": \"\",\n  \"actionName\": \"\"\n}"
            }
          }
        },
        {
          "name": "Get concurrency config",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/settings/concurrency", "host": ["{{baseUrl}}"], "path": ["api","v1","settings","concurrency"] }
          }
        },
        {
          "name": "Put concurrency config",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/api/v1/settings/concurrency", "host": ["{{baseUrl}}"], "path": ["api","v1","settings","concurrency"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"value\": 2,\n  \"delayMinSeconds\": 5,\n  \"delayMaxSeconds\": 15\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Diagnostics",
      "item": [
        {
          "name": "Test captcha",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/v1/diagnostics/captcha", "host": ["{{baseUrl}}"], "path": ["api","v1","diagnostics","captcha"] }
          }
        },
        {
          "name": "Test ShopLike key",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/v1/diagnostics/shoplike?key=YOUR_SHOPLIKE_KEY",
              "host": ["{{baseUrl}}"],
              "path": ["api","v1","diagnostics","shoplike"],
              "query": [{ "key": "key", "value": "YOUR_SHOPLIKE_KEY" }]
            }
          }
        }
      ]
    }
  ]
}
