{
  "version": "1",
  "name": "DPOKit Licence API",
  "type": "collection",
  "description": "Bruno collection for the DPOKit Licence API (api.dpokit.com).\nImport this file into Bruno (https://usebruno.com) to explore and test all endpoints.\n\nSet the LICENCE_KEY environment variable to your pv_live_… key before running plugin-facing requests.",
  "items": [
    {
      "uid": "health-check",
      "type": "http",
      "name": "Health Check",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/health",
        "headers": [],
        "body": {
          "mode": "none"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Returns the API and database health status. No authentication required."
    },
    {
      "uid": "licence-validate",
      "type": "http",
      "name": "Validate Licence",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/licence/validate",
        "headers": [
          {
            "name": "x-licence-key",
            "value": "{{LICENCE_KEY}}",
            "enabled": true
          },
          {
            "name": "Content-Type",
            "value": "application/json",
            "enabled": true
          }
        ],
        "body": {
          "mode": "json",
          "json": "{\n  \"licence_key\": \"{{LICENCE_KEY}}\",\n  \"site_url\": \"{{SITE_URL}}\"\n}"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Validates a licence key for a given site URL. Used by the WordPress plugin on activation and on a scheduled interval.\n\nAuthentication: x-licence-key header.\n\nExpected response fields:\n- valid (boolean)\n- tier: free | pro | agency\n- sites_allowed, sites_used\n- expires_at\n- message"
    },
    {
      "uid": "licence-activate",
      "type": "http",
      "name": "Activate Licence",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/licence/activate",
        "headers": [
          {
            "name": "x-licence-key",
            "value": "{{LICENCE_KEY}}",
            "enabled": true
          },
          {
            "name": "Content-Type",
            "value": "application/json",
            "enabled": true
          }
        ],
        "body": {
          "mode": "json",
          "json": "{\n  \"licence_key\": \"{{LICENCE_KEY}}\",\n  \"site_url\": \"{{SITE_URL}}\"\n}"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Records a new site activation for the licence. Called when the administrator saves their licence key in the WordPress settings screen.\n\nAuthentication: x-licence-key header.\n\nReturns: success, activation_id, tier, features[]."
    },
    {
      "uid": "licence-deactivate",
      "type": "http",
      "name": "Deactivate Licence",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/licence/deactivate",
        "headers": [
          {
            "name": "x-licence-key",
            "value": "{{LICENCE_KEY}}",
            "enabled": true
          },
          {
            "name": "Content-Type",
            "value": "application/json",
            "enabled": true
          }
        ],
        "body": {
          "mode": "json",
          "json": "{\n  \"licence_key\": \"{{LICENCE_KEY}}\",\n  \"site_url\": \"{{SITE_URL}}\"\n}"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Removes the activation for a site URL, freeing one activation slot. Called on WordPress plugin deactivation.\n\nAuthentication: x-licence-key header."
    },
    {
      "uid": "licence-info",
      "type": "http",
      "name": "Get Licence Info",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/licence/info?key={{LICENCE_KEY}}",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer {{JWT_TOKEN}}",
            "enabled": true
          }
        ],
        "body": {
          "mode": "none"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Returns full licence details including activation history. Requires JWT authentication (customer dashboard).\n\nAuthentication: Bearer JWT."
    },
    {
      "uid": "customer-licences",
      "type": "http",
      "name": "List Customer Licences",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/customer/licences",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer {{JWT_TOKEN}}",
            "enabled": true
          }
        ],
        "body": {
          "mode": "none"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Lists all licences belonging to the authenticated customer, with activation counts.\n\nAuthentication: Bearer JWT."
    },
    {
      "uid": "customer-portal",
      "type": "http",
      "name": "Create Billing Portal Session",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/customer/portal",
        "headers": [
          {
            "name": "Content-Type",
            "value": "application/json",
            "enabled": true
          }
        ],
        "body": {
          "mode": "json",
          "json": "{\n  \"email\": \"jane@example.com\"\n}"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Creates a Stripe Billing Portal session for a customer. Returns a redirect URL. No auth required — the customer's identity is established via their email address matching a Stripe customer record."
    },
    {
      "uid": "checkout-session",
      "type": "http",
      "name": "Create Checkout Session",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/checkout/session",
        "headers": [
          {
            "name": "Content-Type",
            "value": "application/json",
            "enabled": true
          }
        ],
        "body": {
          "mode": "json",
          "json": "{\n  \"plan\": \"pro\",\n  \"interval\": \"monthly\",\n  \"email\": \"jane@example.com\"\n}"
        },
        "auth": {
          "mode": "none"
        }
      },
      "docs": "Creates a Stripe Checkout Session. Returns the checkout URL to redirect the customer to.\n\nValid plans: pro, agency\nValid intervals: monthly, annual"
    }
  ],
  "environments": [
    {
      "name": "Production",
      "variables": [
        { "name": "BASE_URL", "value": "https://api.dpokit.com", "enabled": true },
        { "name": "LICENCE_KEY", "value": "pv_live_your_key_here", "enabled": true },
        { "name": "SITE_URL", "value": "https://your-site.com", "enabled": true },
        { "name": "JWT_TOKEN", "value": "", "enabled": true }
      ]
    },
    {
      "name": "Local Development",
      "variables": [
        { "name": "BASE_URL", "value": "http://localhost:4000", "enabled": true },
        { "name": "LICENCE_KEY", "value": "pv_test_your_key_here", "enabled": true },
        { "name": "SITE_URL", "value": "http://localhost:8080", "enabled": true },
        { "name": "JWT_TOKEN", "value": "", "enabled": true }
      ]
    }
  ]
}
