{
  "info": {
    "name": "DeepLink Server — REST API",
    "description": "Official Postman collection for the DeepLink Server API. Set the `baseUrl` variable to your deployment URL, and either `accessToken` (JWT) or `apiKey` (dlk_…) for authentication.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://deeplink-server-54723636766.europe-west1.run.app" },
    { "key": "accessToken", "value": "" },
    { "key": "apiKey", "value": "" },
    { "key": "tenantSlug", "value": "main" },
    { "key": "linkSlug", "value": "demo-link" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{accessToken}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Auth",
      "item": [
        {
          "name": "Login (local)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"email\":    \"admin@example.com\",\n  \"password\": \"changeme\",\n  \"tenant\":   \"{{tenantSlug}}\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/auth/login", "host": ["{{baseUrl}}"], "path": ["api","v1","auth","login"] }
          }
        },
        {
          "name": "Get current user",
          "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/auth/me", "host": ["{{baseUrl}}"], "path": ["api","v1","auth","me"] } }
        },
        {
          "name": "Change password",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"current_password\": \"changeme\",\n  \"new_password\":     \"new-strong-pass\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/auth/change-password", "host": ["{{baseUrl}}"], "path": ["api","v1","auth","change-password"] }
          }
        }
      ]
    },
    {
      "name": "Links",
      "item": [
        {
          "name": "List links",
          "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/links?limit=100", "host": ["{{baseUrl}}"], "path": ["api","v1","links"], "query": [{"key":"limit","value":"100"}] } }
        },
        {
          "name": "Create link",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"title\":              \"Welcome\",\n  \"slug\":               \"welcome\",\n  \"ios_uri_scheme\":     \"myapp://home\",\n  \"ios_store_url\":      \"https://apps.apple.com/app/id1234567890\",\n  \"android_uri_scheme\": \"myapp://home\",\n  \"android_store_url\":  \"https://play.google.com/store/apps/details?id=com.example.app\",\n  \"web_url\":            \"https://example.com\",\n  \"campaign\":           \"launch\",\n  \"custom_data\":        { \"screen\": \"home\" },\n  \"tags\":               [\"onboarding\",\"homepage\"],\n  \"og_title\":           \"Open in our app\",\n  \"og_description\":     \"The best way to experience our product.\",\n  \"og_image\":           \"https://example.com/og.jpg\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/links", "host": ["{{baseUrl}}"], "path": ["api","v1","links"] }
          }
        },
        {
          "name": "Update link",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"title\": \"Updated title\",\n  \"tags\":  [\"v2\"]\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/links/{{linkSlug}}", "host": ["{{baseUrl}}"], "path": ["api","v1","links","{{linkSlug}}"] }
          }
        },
        {
          "name": "Delete link",
          "request": { "method": "DELETE", "url": { "raw": "{{baseUrl}}/api/v1/links/{{linkSlug}}", "host": ["{{baseUrl}}"], "path": ["api","v1","links","{{linkSlug}}"] } }
        },
        {
          "name": "Get QR code (PNG)",
          "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/links/{{linkSlug}}/qr?size=512", "host": ["{{baseUrl}}"], "path": ["api","v1","links","{{linkSlug}}","qr"], "query": [{"key":"size","value":"512"}] } }
        }
      ]
    },
    {
      "name": "Analytics",
      "item": [
        { "name": "Overview",  "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/analytics/overview?days=30", "host": ["{{baseUrl}}"], "path": ["api","v1","analytics","overview"], "query": [{"key":"days","value":"30"}] } } },
        { "name": "Funnel",    "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/funnel?days=30&platform=ios", "host": ["{{baseUrl}}"], "path": ["api","v1","funnel"], "query": [{"key":"days","value":"30"},{"key":"platform","value":"ios"}] } } },
        { "name": "Retention", "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/analytics/retention?days=60", "host": ["{{baseUrl}}"], "path": ["api","v1","analytics","retention"], "query": [{"key":"days","value":"60"}] } } }
      ]
    },
    {
      "name": "Events",
      "item": [
        {
          "name": "Send custom event",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Api-Key", "value": "{{apiKey}}" }
            ],
            "body": { "mode": "raw", "raw": "{\n  \"name\":        \"purchase\",\n  \"tenant_slug\": \"{{tenantSlug}}\",\n  \"link_slug\":   \"{{linkSlug}}\",\n  \"properties\":  { \"product\": \"pro\" },\n  \"revenue\":     19.99,\n  \"currency\":    \"EUR\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/events", "host": ["{{baseUrl}}"], "path": ["api","v1","events"] }
          }
        }
      ]
    },
    {
      "name": "Users & tenants",
      "item": [
        { "name": "List users",   "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/users", "host": ["{{baseUrl}}"], "path": ["api","v1","users"] } } },
        {
          "name": "Create user (invite by email)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"email\":           \"new@example.com\",\n  \"name\":            \"New User\",\n  \"role\":            \"user\",\n  \"send_invitation\": true\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/users", "host": ["{{baseUrl}}"], "path": ["api","v1","users"] }
          }
        },
        { "name": "Tenant settings", "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/tenants/current", "host": ["{{baseUrl}}"], "path": ["api","v1","tenants","current"] } } }
      ]
    },
    {
      "name": "Banners",
      "item": [
        { "name": "List banners",   "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/banners", "host": ["{{baseUrl}}"], "path": ["api","v1","banners"] } } },
        { "name": "List templates", "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/banners/templates", "host": ["{{baseUrl}}"], "path": ["api","v1","banners","templates"] } } },
        {
          "name": "Create banner",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"name\":         \"Homepage bar\",\n  \"link_slug\":    \"{{linkSlug}}\",\n  \"variant\":      \"bar\",\n  \"position\":     \"top\",\n  \"text\":         \"Continue in our app\",\n  \"button_text\":  \"Open\",\n  \"accent_color\": \"#6366f1\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/banners", "host": ["{{baseUrl}}"], "path": ["api","v1","banners"] }
          }
        }
      ]
    },
    {
      "name": "Scheduled reports",
      "item": [
        { "name": "List reports", "request": { "method": "GET", "url": { "raw": "{{baseUrl}}/api/v1/scheduled-reports", "host": ["{{baseUrl}}"], "path": ["api","v1","scheduled-reports"] } } },
        {
          "name": "Create daily digest",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"name\":          \"Daily team digest\",\n  \"report_type\":   \"daily_digest\",\n  \"schedule_cron\": \"0 9 * * *\",\n  \"recipients\":    [\"ops@example.com\"]\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/scheduled-reports", "host": ["{{baseUrl}}"], "path": ["api","v1","scheduled-reports"] }
          }
        }
      ]
    }
  ]
}
