{
  "info": {
    "name": "Stack Spend API",
    "description": "Stack Spend public API for line items, daily rollups, and anomaly alerts. Create an API key in Settings → API Keys.",
    "schema": "https://schema.postman.com/json/collection/v2.1.0/draft-07/collection.json"
  },
  "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"
      }
    ]
  },
  "variable": [
    {
      "key": "api_base_url",
      "value": "https://stackspend-api.up.railway.app"
    },
    {
      "key": "api_key",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Line Items",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{api_base_url}}/api/v1/public/line-items?start_date=2025-01-01&end_date=2025-01-31&limit=50",
          "host": ["{{api_base_url}}"],
          "path": ["api", "v1", "public", "line-items"],
          "query": [
            { "key": "start_date", "value": "2025-01-01", "description": "Required. YYYY-MM-DD" },
            { "key": "end_date", "value": "2025-01-31", "description": "Required. YYYY-MM-DD" },
            { "key": "limit", "value": "50", "description": "1-1000, default 50" },
            { "key": "cursor", "value": "", "description": "Pagination cursor from meta.next_cursor" },
            { "key": "provider", "value": "", "description": "Filter by provider (e.g. aws, openai)" },
            { "key": "service", "value": "", "description": "Filter by service" },
            { "key": "category", "value": "", "description": "Filter by category" }
          ]
        },
        "description": "Cursor-paginated cost line items. Requires line_items:read scope."
      }
    },
    {
      "name": "Daily Rollups by Provider",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{api_base_url}}/api/v1/public/rollups/daily?start_date=2025-01-01&end_date=2025-01-31&group_by=provider",
          "host": ["{{api_base_url}}"],
          "path": ["api", "v1", "public", "rollups", "daily"],
          "query": [
            { "key": "start_date", "value": "2025-01-01", "description": "Required. YYYY-MM-DD" },
            { "key": "end_date", "value": "2025-01-31", "description": "Required. YYYY-MM-DD, max 366 days" },
            { "key": "group_by", "value": "provider", "description": "provider, service, or category" }
          ]
        },
        "description": "Pre-aggregated daily costs. Requires rollups:read scope."
      }
    },
    {
      "name": "Daily Rollups by Service",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{api_base_url}}/api/v1/public/rollups/daily?start_date=2025-01-01&end_date=2025-01-31&group_by=service",
          "host": ["{{api_base_url}}"],
          "path": ["api", "v1", "public", "rollups", "daily"],
          "query": [
            { "key": "start_date", "value": "2025-01-01" },
            { "key": "end_date", "value": "2025-01-31" },
            { "key": "group_by", "value": "service" }
          ]
        }
      }
    },
    {
      "name": "Daily Rollups by Category",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{api_base_url}}/api/v1/public/rollups/daily?start_date=2025-01-01&end_date=2025-01-31&group_by=category",
          "host": ["{{api_base_url}}"],
          "path": ["api", "v1", "public", "rollups", "daily"],
          "query": [
            { "key": "start_date", "value": "2025-01-01" },
            { "key": "end_date", "value": "2025-01-31" },
            { "key": "group_by", "value": "category" }
          ]
        }
      }
    },
    {
      "name": "Anomalies",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{api_base_url}}/api/v1/public/anomalies?limit=10",
          "host": ["{{api_base_url}}"],
          "path": ["api", "v1", "public", "anomalies"],
          "query": [
            { "key": "limit", "value": "10", "description": "1-100, default 10" },
            { "key": "since", "value": "", "description": "YYYY-MM-DD, default 7 days ago" },
            { "key": "provider_type", "value": "", "description": "Filter by provider" },
            { "key": "severity", "value": "", "description": "low, medium, high, critical" },
            { "key": "status", "value": "", "description": "Filter by status" }
          ]
        },
        "description": "Spend anomaly alerts. Requires anomalies:read scope."
      }
    }
  ]
}
