{
  "info": {
    "name": "Zeridion Flare API",
    "description": "Managed background jobs for every stack (official SDKs for .NET, TypeScript, Python, Go, Java, PHP, and Ruby) — full Flare API collection. Set the `baseUrl` and `apiKey` collection variables before running.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "zeridion-flare-v1"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.zeridion.com",
      "type": "string",
      "description": "Base URL — override with https://api.dev.zeridion.com for Dev or http://localhost:5100 for local."
    },
    {
      "key": "apiKey",
      "value": "zf_live_sk_xxxxxxxxxxxxxxxxxxxx",
      "type": "string",
      "description": "Bearer token used for all Flare API requests."
    },
    {
      "key": "jobId",
      "value": "",
      "type": "string",
      "description": "Populated automatically by the Create Job request via a test script."
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Auth",
      "description": "Platform authentication endpoints (signup, login, account).",
      "item": [
        {
          "name": "Signup",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/auth/signup",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "auth", "signup"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"you@example.com\",\n  \"password\": \"ChangeMe123!\",\n  \"name\": \"Your Name\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Create a new Zeridion account. Returns a session token or verification flow."
          },
          "response": []
        },
        {
          "name": "Login",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.token) {",
                  "  pm.collectionVariables.set('apiKey', json.token);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/auth/login",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "auth", "login"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"you@example.com\",\n  \"password\": \"ChangeMe123!\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Authenticate and receive a session token. The test script stores the returned token as the `apiKey` collection variable."
          },
          "response": []
        },
        {
          "name": "Account (me)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/auth/me",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "auth", "me"]
            },
            "description": "Return the currently authenticated user's profile."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Jobs",
      "description": "Create, inspect, list, retry, and cancel background jobs.",
      "item": [
        {
          "name": "Create Job",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const json = pm.response.json();",
                  "if (json && json.id) {",
                  "  pm.collectionVariables.set('jobId', json.id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"job_type\": \"postman.smoke.test\",\n  \"queue\": \"default\",\n  \"payload\": {\n    \"source\": \"postman\",\n    \"created_at\": \"{{$isoTimestamp}}\"\n  },\n  \"tags\": [\"postman\", \"smoke\"]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Enqueue a new background job. Stores the returned `id` as the `jobId` collection variable."
          },
          "response": []
        },
        {
          "name": "Get Job",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs/{{jobId}}",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs", "{{jobId}}"]
            },
            "description": "Fetch a single job by its ID."
          },
          "response": []
        },
        {
          "name": "List Jobs",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs?limit=50",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs"],
              "query": [
                { "key": "state", "value": "", "disabled": true, "description": "Filter by state: pending|running|succeeded|failed|cancelled" },
                { "key": "queue", "value": "", "disabled": true, "description": "Filter by queue name" },
                { "key": "job_type", "value": "", "disabled": true, "description": "Filter by job_type" },
                { "key": "created_after", "value": "", "disabled": true, "description": "ISO-8601 lower bound" },
                { "key": "created_before", "value": "", "disabled": true, "description": "ISO-8601 upper bound" },
                { "key": "limit", "value": "50", "description": "Page size, default 50" },
                { "key": "cursor", "value": "", "disabled": true, "description": "Opaque pagination cursor from previous response" }
              ]
            },
            "description": "List jobs with optional filters and cursor-based pagination."
          },
          "response": []
        },
        {
          "name": "Get Job Events",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs/{{jobId}}/events",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs", "{{jobId}}", "events"]
            },
            "description": "Return the event/attempt history for a specific job."
          },
          "response": []
        },
        {
          "name": "Retry Job",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs/{{jobId}}/retry",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs", "{{jobId}}", "retry"]
            },
            "description": "Re-enqueue a failed or cancelled job for another attempt."
          },
          "response": []
        },
        {
          "name": "Cancel Job",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/jobs/{{jobId}}/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "jobs", "{{jobId}}", "cancel"]
            },
            "description": "Cancel a pending or running job."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Billing",
      "description": "Billing status and product catalogue.",
      "item": [
        {
          "name": "Billing Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/billing/status",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "billing", "status"]
            },
            "description": "Return the current subscription tier, quota usage, and renewal date for the authenticated project."
          },
          "response": []
        },
        {
          "name": "Products",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/products",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "products"]
            },
            "description": "List available subscription plans and their job quota limits."
          },
          "response": []
        },
        {
          "name": "Checkout",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/billing/checkout",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "billing", "checkout"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"plan_id\": \"pro-monthly\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Create a Stripe checkout session for upgrading the subscription."
          },
          "response": []
        },
        {
          "name": "Billing Portal",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/billing/portal",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "billing", "portal"]
            },
            "description": "Generate a Stripe customer portal link for managing payment methods and invoices."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Account",
      "description": "Project account details.",
      "item": [
        {
          "name": "Account Details",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/platform/v1/account",
              "host": ["{{baseUrl}}"],
              "path": ["platform", "v1", "account"]
            },
            "description": "Return the project's display name, created date, and current settings."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Metrics",
      "description": "Job throughput and queue depth metrics.",
      "item": [
        {
          "name": "Metrics Summary",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/metrics/summary?period=24h",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "metrics", "summary"],
              "query": [
                { "key": "period", "value": "24h", "description": "Time window: 1h | 24h | 7d | 30d" }
              ]
            },
            "description": "Aggregated job counts, success rate, and p50/p95/p99 latencies for the given period."
          },
          "response": []
        },
        {
          "name": "Throughput",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/metrics/throughput?period=24h&granularity=1h",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "metrics", "throughput"],
              "query": [
                { "key": "period", "value": "24h" },
                { "key": "granularity", "value": "1h" }
              ]
            },
            "description": "Time-series job throughput (jobs/s bucketed by granularity)."
          },
          "response": []
        },
        {
          "name": "Queue Depths",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/metrics/queues",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "metrics", "queues"]
            },
            "description": "Current pending job count per queue."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Workers",
      "description": "Worker registration, polling, and acknowledgement.",
      "item": [
        {
          "name": "Register Worker",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/workers/register",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "workers", "register"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"worker_id\": \"postman-worker-1\",\n  \"queues\": [\"default\"],\n  \"job_types\": [\"postman.smoke.test\"]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Register this process as a worker capable of handling the given queues and job types."
          },
          "response": []
        },
        {
          "name": "Poll",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/workers/poll",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "workers", "poll"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"worker_id\": \"postman-worker-1\",\n  \"queues\": [\"default\"],\n  \"max_jobs\": 1\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Long-poll for the next available job from the requested queues."
          },
          "response": []
        },
        {
          "name": "Acknowledge",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/workers/ack",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "workers", "ack"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"job_id\": \"{{jobId}}\",\n  \"worker_id\": \"postman-worker-1\",\n  \"status\": \"succeeded\",\n  \"duration_ms\": 42\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Acknowledge job completion (succeeded or failed). Provide an `error` object on failure."
          },
          "response": []
        },
        {
          "name": "Heartbeat",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": {
              "raw": "{{baseUrl}}/flare/v1/workers/heartbeat",
              "host": ["{{baseUrl}}"],
              "path": ["flare", "v1", "workers", "heartbeat"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"worker_id\": \"postman-worker-1\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "description": "Keep the worker registration alive. Call every 30s while processing."
          },
          "response": []
        }
      ]
    }
  ]
}
