{
  "info": {
    "name": "ClauseHub Energy API",
    "description": "Complete collection for the ClauseHub Energy API. Covers health checks, public search, and authenticated CRUD operations for suppliers and tariffs.\n\nBase URL: https://api.clausehub.net\nFormat: JSON:API (application/vnd.api+json)\nAuth: Supabase JWT Bearer token",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{token}}", "type": "string" }]
  },
  "variable": [
    { "key": "base_url", "value": "https://api.clausehub.net" },
    { "key": "token", "value": "<your-jwt-token>" }
  ],
  "item": [
    {
      "name": "Health & Schema",
      "item": [
        {
          "name": "Health Check",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/health", "host": ["{{base_url}}"], "path": ["energy", "health"] }
          }
        },
        {
          "name": "OpenAPI Schema",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{base_url}}/energy/schema", "host": ["{{base_url}}"], "path": ["energy", "schema"] }
          }
        }
      ]
    },
    {
      "name": "Public Search",
      "item": [
        {
          "name": "Search Tariffs (Public)",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/tariffs/search/public", "host": ["{{base_url}}"], "path": ["energy", "tariffs", "search", "public"] }
          }
        },
        {
          "name": "Search Tariffs with Filters (Public)",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": {
              "raw": "{{base_url}}/energy/tariffs/search/public?filter[tariffType]=Fixed&filter[region]=South%20East",
              "host": ["{{base_url}}"],
              "path": ["energy", "tariffs", "search", "public"],
              "query": [
                { "key": "filter[tariffType]", "value": "Fixed" },
                { "key": "filter[region]", "value": "South East" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Suppliers",
      "item": [
        {
          "name": "List Suppliers",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/suppliers", "host": ["{{base_url}}"], "path": ["energy", "suppliers"] }
          }
        },
        {
          "name": "Get Supplier",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/suppliers/:id", "host": ["{{base_url}}"], "path": ["energy", "suppliers", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        },
        {
          "name": "Create Supplier",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/vnd.api+json" },
              { "key": "Content-Type", "value": "application/vnd.api+json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"type\": \"suppliers\",\n    \"attributes\": {\n      \"name\": \"Example Energy Ltd\",\n      \"website\": \"https://example-energy.co.uk\"\n    }\n  }\n}"
            },
            "url": { "raw": "{{base_url}}/energy/suppliers", "host": ["{{base_url}}"], "path": ["energy", "suppliers"] }
          }
        },
        {
          "name": "Update Supplier",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Accept", "value": "application/vnd.api+json" },
              { "key": "Content-Type", "value": "application/vnd.api+json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"type\": \"suppliers\",\n    \"id\": \":id\",\n    \"attributes\": {\n      \"name\": \"Updated Energy Ltd\"\n    }\n  }\n}"
            },
            "url": { "raw": "{{base_url}}/energy/suppliers/:id", "host": ["{{base_url}}"], "path": ["energy", "suppliers", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        },
        {
          "name": "Delete Supplier",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/suppliers/:id", "host": ["{{base_url}}"], "path": ["energy", "suppliers", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        }
      ]
    },
    {
      "name": "Tariffs",
      "item": [
        {
          "name": "List Tariffs",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/tariffs", "host": ["{{base_url}}"], "path": ["energy", "tariffs"] }
          }
        },
        {
          "name": "Get Tariff",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/tariffs/:id", "host": ["{{base_url}}"], "path": ["energy", "tariffs", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        },
        {
          "name": "Create Tariff",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/vnd.api+json" },
              { "key": "Content-Type", "value": "application/vnd.api+json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"type\": \"tariffs\",\n    \"attributes\": {\n      \"name\": \"Example Fixed Tariff 2026\",\n      \"clientTariffId\": \"EX-FIXED-2026\",\n      \"consumableRange\": \"Single\",\n      \"consumables\": [\n        {\n          \"type\": \"Electricity\",\n          \"value\": 24.5,\n          \"consumptionUnit\": \"kWh\",\n          \"standingChargeValue\": 46.36\n        }\n      ],\n      \"contract\": [\n        {\n          \"type\": \"Fixed\",\n          \"paymentMethod\": \"Direct Debit\",\n          \"exitFees\": [{ \"value\": 0, \"unit\": \"GBP\" }]\n        }\n      ]\n    },\n    \"relationships\": {\n      \"supplier\": {\n        \"data\": { \"type\": \"suppliers\", \"id\": \"<supplier-id>\" }\n      }\n    }\n  }\n}"
            },
            "url": { "raw": "{{base_url}}/energy/tariffs", "host": ["{{base_url}}"], "path": ["energy", "tariffs"] }
          }
        },
        {
          "name": "Update Tariff",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Accept", "value": "application/vnd.api+json" },
              { "key": "Content-Type", "value": "application/vnd.api+json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"type\": \"tariffs\",\n    \"id\": \":id\",\n    \"attributes\": {\n      \"name\": \"Updated Tariff Name\"\n    }\n  }\n}"
            },
            "url": { "raw": "{{base_url}}/energy/tariffs/:id", "host": ["{{base_url}}"], "path": ["energy", "tariffs", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        },
        {
          "name": "Delete Tariff",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/tariffs/:id", "host": ["{{base_url}}"], "path": ["energy", "tariffs", ":id"], "variable": [{ "key": "id", "value": "" }] }
          }
        },
        {
          "name": "Search Tariffs (Authenticated)",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/vnd.api+json" }],
            "url": { "raw": "{{base_url}}/energy/tariffs/search", "host": ["{{base_url}}"], "path": ["energy", "tariffs", "search"] }
          }
        }
      ]
    }
  ]
}
