{
  "info": {
    "name": "Invoodle API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Set baseUrl and apiKey before use. Writes affect your account. Copy the created invoice id into invoiceId. PDF returns JSON containing a browser download URL. Share links are readable snapshots without revocation."
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://YOUR_PROJECT.supabase.co/functions/v1/api-v1"
    },
    {
      "key": "apiKey",
      "value": "invd_live_YOUR_KEY"
    },
    {
      "key": "invoiceId",
      "value": "REPLACE_WITH_CREATED_ID"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Whoami",
      "request": {
        "method": "GET",
        "url": "{{baseUrl}}/me"
      }
    },
    {
      "name": "List invoices",
      "request": {
        "method": "GET",
        "url": "{{baseUrl}}/invoices?limit=25"
      }
    },
    {
      "name": "Create invoice",
      "request": {
        "method": "POST",
        "url": "{{baseUrl}}/invoices",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"invoice_number\": \"INV-1001\",\n  \"total\": 1234.56,\n  \"currency\": \"USD\",\n  \"data\": {\n    \"storeName\": \"Acme\",\n    \"items\": [\n      {\n        \"description\": \"Logo\",\n        \"quantity\": 1,\n        \"rate\": 1234.56,\n        \"amount\": 1234.56\n      }\n    ],\n    \"country\": \"US\",\n    \"currencyKey\": \"USD\",\n    \"invoiceNumber\": \"INV-1001\",\n    \"status\": \"draft\"\n  },\n  \"status\": \"draft\"\n}"
        }
      }
    },
    {
      "name": "Get invoice",
      "request": {
        "method": "GET",
        "url": "{{baseUrl}}/invoices/{{invoiceId}}"
      }
    },
    {
      "name": "Update invoice",
      "request": {
        "method": "PATCH",
        "url": "{{baseUrl}}/invoices/{{invoiceId}}",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{ \"status\": \"paid\" }"
        }
      }
    },
    {
      "name": "Delete invoice",
      "request": {
        "method": "DELETE",
        "url": "{{baseUrl}}/invoices/{{invoiceId}}"
      }
    },
    {
      "name": "Share (saved)",
      "request": {
        "method": "POST",
        "url": "{{baseUrl}}/invoices/{{invoiceId}}/share"
      }
    },
    {
      "name": "PDF URL",
      "request": {
        "method": "POST",
        "url": "{{baseUrl}}/invoices/{{invoiceId}}/pdf"
      }
    },
    {
      "name": "Stateless share + QR",
      "request": {
        "method": "POST",
        "url": "{{baseUrl}}/share",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{ \"data\": { \"storeName\": \"Acme\", \"items\": [{ \"description\": \"Logo\", \"quantity\": 1, \"rate\": 100, \"amount\": 100 }] } }"
        }
      }
    }
  ]
}
