{
  "kind": "company",
  "basic": {
    "name": "",
    "short_title": "Gated portal data (session bootstrap)",
    "version": "1.0",
    "category": "",
    "tags": "portal, session, cookies, csrf",
    "about": "## What this API does\n\nExposes a data endpoint of a portal that only answers with a valid session (cookies plus a CSRF token). Before calling the upstream, the gateway opens the portal's own login or landing page in a browser, harvests the named session cookie and the `meta[name='csrf-token']` value, and sends them with the request. Buyers never see or need them.\n\n## The session_bootstrap block\n\n- `url`: the page opened to obtain the session (login or landing page).\n- `cookies`: the cookie names carried over to the upstream call (an empty list carries every cookie of the upstream host).\n- `csrf`: where the token is read (`selector` + `attribute`) and the request header it is sent as.\n- `ttl_seconds`: how long a harvested session is reused before it is refreshed (900 = 15 minutes).\n- `storage_profile_id`: the id (`sp_…`) of a **session profile** block from your Blocks vault whose seed cookies / local storage pre-authenticate the browser; remove it for an anonymous session.\n\nThe block travels with the route; replace its placeholders before publishing.\n\n## Notes\n\nDescribe what the records contain and how fresh they are.",
    "status": "private"
  },
  "datasource": {
    "datasource_type": "custom_http_api",
    "custom_http_routes": [
      {
        "name": "Portal records",
        "method": "GET",
        "playground_path": "/records",
        "upstream_url": "{{PORTAL_DATA_URL}}",
        "headers": [],
        "query_params": [
          { "key": "page", "visibility": "public", "type": "number", "required": false }
        ],
        "body_mode": "fields",
        "body_fields": [],
        "session_bootstrap": {
          "enabled": true,
          "url": "{{PORTAL_LOGIN_OR_LANDING_URL}}",
          "wait_until": "load",
          "ttl_seconds": 900,
          "cookies": ["{{SESSION_COOKIE_NAME}}"],
          "csrf": {
            "selector": "meta[name='csrf-token']",
            "attribute": "content",
            "header": "X-CSRF-Token"
          },
          "storage_profile_id": "{{SESSION_PROFILE_ID}}"
        },
        "request_policy": {
          "max_requests_per_buyer_per_day_paid": 1000,
          "max_requests_total_trial": 3,
          "estimated_total_requests": 100000
        },
        "proxy": {
          "visibility": "private",
          "value": {
            "hostname": "{{YOUR_PROXY_HOST_PORT}}",
            "username": "{{YOUR_PROXY_USERNAME}}",
            "password": "{{YOUR_PROXY_PASSWORD}}"
          }
        }
      }
    ]
  },
  "pricing": {
    "requests_per_credit": 50,
    "plans": [],
    "trial_enabled": true,
    "trial_requests": 3
  }
}
