{
  "info": {
    "name": "GeoLayer API",
    "description": "Official Postman collection for the GeoLayer.io REST API. Set {{API_KEY}} in your environment variables (Dashboard → Developers → API Key on geolayer.io).",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{API_KEY}}", "type": "string" }]
  },
  "variable": [
    { "key": "BASE_URL", "value": "https://geolayer.io" },
    { "key": "API_KEY", "value": "gl_set_me_in_env", "type": "secret" }
  ],
  "item": [
    {
      "name": "Submit search task",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/v1/tasks/submit",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"keyword\": \"Plumber\",\n  \"city\": \"Austin\",\n  \"max_leads\": 20\n}"
        }
      },
      "event": [{
        "listen": "test",
        "script": { "exec": [
          "pm.test('returns 202 + submission_id', function () {",
          "  pm.response.to.have.status(202);",
          "  const json = pm.response.json();",
          "  pm.expect(json).to.have.property('submission_id');",
          "  pm.environment.set('LAST_SUBMISSION_ID', json.submission_id);",
          "});"
        ], "type": "text/javascript" }
      }]
    },
    {
      "name": "Fetch task results",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/v1/tasks/results/{{LAST_SUBMISSION_ID}}"
      },
      "event": [{
        "listen": "test",
        "script": { "exec": [
          "pm.test('200 + status field', function () {",
          "  pm.response.to.have.status(200);",
          "  pm.expect(pm.response.json()).to.have.property('status');",
          "});"
        ], "type": "text/javascript" }
      }]
    },
    {
      "name": "Get business profile (sync enrichment)",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/v1/get-profile",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"Acme Plumbing\",\n  \"city\": \"Austin\",\n  \"state\": \"TX\"\n}"
        }
      }
    },
    {
      "name": "List recent tasks",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/v1/tasks/list-tasks"
      }
    },
    {
      "name": "Who am I (auth test)",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/v1/me"
      }
    },
    {
      "name": "Bulk CSV export",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{BASE_URL}}/v1/leads/export?keyword=Plumber&city=Austin&limit=500",
          "host": ["{{BASE_URL}}"],
          "path": ["v1", "leads", "export"],
          "query": [
            { "key": "keyword", "value": "Plumber" },
            { "key": "city", "value": "Austin" },
            { "key": "limit", "value": "500" }
          ]
        }
      }
    },
    {
      "name": "Add to suppression list",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/v1/suppression",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"email\": \"unsubscribed@example.com\",\n  \"reason\": \"customer-requested\"\n}"
        }
      }
    },
    {
      "name": "Configure webhook URL",
      "request": {
        "method": "PUT",
        "url": "{{BASE_URL}}/v1/webhooks",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"url\": \"https://your-app.example.com/webhooks/geolayer\"\n}"
        }
      }
    },
    {
      "name": "Send test webhook",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/v1/webhooks/test"
      }
    },
    {
      "name": "List bundles (public)",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/v1/bundles",
        "auth": { "type": "noauth" }
      }
    }
  ]
}
