Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

31.0 KB
Raw Blame
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";

type ParameterMetadata = {
  label: string;
  type: "text" | "number" | "select";
  options?: string[];
  placeholder?: string;
};

export interface EndpointConfig {
  method: HttpMethod;
  path: string;
  name: string;
  description?: string;
  hasCommonParams: boolean;
  specificParams?: string[];
  requiredParams?: string[];
  pathParams?: string[];
  hasRequestBody?: boolean;
  requestBodyExample?: object;
  parameterMetadata?: Record<string, ParameterMetadata>;
}

export interface EndpointCategory {
  name: string;
  endpoints: EndpointConfig[];
}

export const endpointCategories: EndpointCategory[] = [
  {
    name: "Sites",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site",
        name: "Get Site",
        description: "Returns details for a specific site",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/has-data",
        name: "Get Site Has Data",
        description: "Returns whether the site has received analytics events",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/is-public",
        name: "Get Site Public Status",
        description: "Returns whether the site is publicly accessible",
        hasCommonParams: false,
      },
      {
        method: "DELETE",
        path: "/sites/:site",
        name: "Delete Site",
        description: "Permanently deletes a site and all its data. Requires admin/owner role.",
        hasCommonParams: false,
      },
      {
        method: "PUT",
        path: "/sites/:site/config",
        name: "Update Site Config",
        description: "Updates site configuration settings. Requires admin/owner role.",
        hasCommonParams: false,
        hasRequestBody: true,
        requestBodyExample: {
          public: true,
          blockBots: true,
          excludedCountries: ["CN", "RU"],
        },
      },
      {
        method: "GET",
        path: "/sites/:site/excluded-ips",
        name: "Get Excluded IPs",
        description: "Returns the list of excluded IP addresses",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/excluded-countries",
        name: "Get Excluded Countries",
        description: "Returns the list of excluded country codes",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/excluded-paths",
        name: "Get Excluded Paths",
        description: "Returns the list of excluded URL paths",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/excluded-hostnames",
        name: "Get Excluded Hostnames",
        description: "Returns the list of excluded hostnames",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/excluded-user-agents",
        name: "Get Excluded User Agents",
        description: "Returns the list of excluded user-agent patterns",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/private-link-config",
        name: "Get Private Link Config",
        description: "Returns the private link key configuration",
        hasCommonParams: false,
      },
      {
        method: "POST",
        path: "/sites/:site/private-link-config",
        name: "Update Private Link",
        description: "Generates or revokes a private link key. Requires admin/owner role.",
        hasCommonParams: false,
        hasRequestBody: true,
        requestBodyExample: {
          action: "generate_private_link_key",
        },
      },
    ],
  },
  {
    name: "Organizations",
    endpoints: [
      {
        method: "GET",
        path: "/organizations",
        name: "Get My Organizations",
        description:
          "Returns all organizations the authenticated user is a member of. The members array is only populated for session-cookie requests; Bearer/API-key callers receive an empty members array and should use Get Organization Members instead.",
        hasCommonParams: false,
      },
      {
        method: "POST",
        path: "/organizations/:organizationId/sites",
        name: "Create Site",
        description: "Creates a new site in an organization. Requires admin/owner role.",
        hasCommonParams: false,
        pathParams: ["organizationId"],
        hasRequestBody: true,
        requestBodyExample: {
          domain: "example.com",
          name: "My Website",
          public: false,
          blockBots: true,
          saltUserIds: false,
          excludedIPs: [],
          excludedCountries: [],
          sessionReplay: false,
          webVitals: false,
          trackErrors: false,
          trackOutbound: true,
          trackUrlParams: true,
          trackInitialPageView: true,
          trackSpaNavigation: true,
          trackIp: false,
          trackButtonClicks: false,
          trackCopy: false,
          trackFormInteractions: false,
          tags: [],
        },
      },
      {
        method: "GET",
        path: "/organizations/:organizationId/sites",
        name: "Get Organization Sites",
        description: "Returns all sites in an organization visible to the authenticated user",
        hasCommonParams: false,
        pathParams: ["organizationId"],
      },
      {
        method: "GET",
        path: "/organizations/:organizationId/members",
        name: "Get Organization Members",
        description: "Returns all members of an organization with user details",
        hasCommonParams: false,
        pathParams: ["organizationId"],
      },
      {
        method: "POST",
        path: "/organizations/:organizationId/members",
        name: "Add Organization Member",
        description: "Adds a user to an organization with a specified role",
        hasCommonParams: false,
        pathParams: ["organizationId"],
        hasRequestBody: true,
        requestBodyExample: {
          email: "[email protected]",
          role: "member",
        },
      },
    ],
  },
  {
    name: "Teams",
    endpoints: [
      {
        method: "GET",
        path: "/organizations/:organizationId/teams",
        name: "Get Teams",
        description: "Returns the teams in an organization with members and sites",
        hasCommonParams: false,
        pathParams: ["organizationId"],
      },
      {
        method: "POST",
        path: "/organizations/:organizationId/teams",
        name: "Create Team",
        description: "Creates a team. Requires admin/owner role.",
        hasCommonParams: false,
        pathParams: ["organizationId"],
        hasRequestBody: true,
        requestBodyExample: {
          name: "Marketing",
          memberUserIds: [],
          siteIds: [],
        },
      },
      {
        method: "PUT",
        path: "/organizations/:organizationId/teams/:teamId",
        name: "Update Team",
        description: "Updates a team's name, members, or sites. Requires admin/owner role.",
        hasCommonParams: false,
        pathParams: ["organizationId", "teamId"],
        hasRequestBody: true,
        requestBodyExample: {
          name: "Growth",
        },
      },
      {
        method: "DELETE",
        path: "/organizations/:organizationId/teams/:teamId",
        name: "Delete Team",
        description: "Deletes a team. Requires admin/owner role.",
        hasCommonParams: false,
        pathParams: ["organizationId", "teamId"],
      },
    ],
  },
  {
    name: "Overview",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/overview",
        name: "Get Overview",
        description: "Returns high-level analytics metrics for a site",
        hasCommonParams: true,
      },
      {
        method: "GET",
        path: "/sites/:site/overview/time-series",
        name: "Get Overview (Time Series)",
        description: "Returns time-series analytics data broken down by time buckets",
        hasCommonParams: true,
        specificParams: ["bucket"],
      },
      {
        method: "GET",
        path: "/sites/:site/metric",
        name: "Get Metric",
        description: "Returns dimensional analytics broken down by a specific parameter",
        hasCommonParams: true,
        specificParams: ["parameter", "limit", "page"],
        requiredParams: ["parameter"],
      },
      {
        method: "GET",
        path: "/sites/:site/page-titles",
        name: "Get Page Titles",
        description: "Returns page title metrics with pagination",
        hasCommonParams: true,
        specificParams: ["limit", "page"],
      },
      {
        method: "GET",
        path: "/sites/:site/live-user-count",
        name: "Get Live Visitors",
        description: "Returns the count of active sessions within the specified time window",
        hasCommonParams: false,
        specificParams: ["minutes"],
      },
    ],
  },
  {
    name: "Events",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/events",
        name: "Get Events",
        description: "Returns a paginated list of events with cursor-based pagination",
        hasCommonParams: true,
        specificParams: ["page_size", "since_timestamp", "before_timestamp"],
      },
      {
        method: "GET",
        path: "/sites/:site/events/names",
        name: "Get Event Names",
        description: "Returns list of unique custom event names with counts",
        hasCommonParams: true,
      },
      {
        method: "GET",
        path: "/sites/:site/events/time-series",
        name: "Get Event Time Series",
        description: "Returns time-series counts for top custom events",
        hasCommonParams: true,
        specificParams: ["bucket", "limit"],
      },
      {
        method: "GET",
        path: "/sites/:site/events/count",
        name: "Get Event Counts",
        description: "Returns time-series event counts grouped by event type",
        hasCommonParams: true,
        specificParams: ["bucket"],
      },
      {
        method: "GET",
        path: "/sites/:site/events/properties",
        name: "Get Event Properties",
        description: "Returns property key-value pairs for a specific event",
        hasCommonParams: true,
        specificParams: ["event_name"],
        requiredParams: ["event_name"],
      },
      {
        method: "GET",
        path: "/sites/:site/events/autocapture",
        name: "Get Autocapture Events",
        description: "Returns autocapture events of a given type grouped by display value with counts",
        hasCommonParams: true,
        requiredParams: ["type"],
        specificParams: ["type"],
        parameterMetadata: {
          type: {
            label: "Type",
            type: "select",
            options: ["outbound", "button_click", "form_submit", "copy"],
          },
        },
      },
      {
        method: "GET",
        path: "/sites/:site/events/autocapture-values",
        name: "Get Autocapture Values",
        description: "Returns the most common prop values for an autocapture type (goal/funnel suggestions)",
        hasCommonParams: true,
        requiredParams: ["type"],
        specificParams: ["type"],
        parameterMetadata: {
          type: {
            label: "Type",
            type: "select",
            options: ["outbound", "button_click", "form_submit", "copy"],
          },
        },
      },
      {
        method: "GET",
        path: "/sites/:site/events/outbound",
        name: "Get Outbound Links",
        description: "Returns outbound link clicks with occurrence counts",
        hasCommonParams: true,
      },
    ],
  },
  {
    name: "Errors",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/errors/names",
        name: "Get Error Names",
        description: "Returns unique error messages with occurrence and session counts",
        hasCommonParams: true,
        specificParams: ["page", "limit"],
      },
      {
        method: "GET",
        path: "/sites/:site/errors/events",
        name: "Get Error Events",
        description: "Returns individual error occurrences with context and stack traces",
        hasCommonParams: true,
        requiredParams: ["errorMessage"],
        specificParams: ["errorMessage", "page", "limit"],
      },
      {
        method: "GET",
        path: "/sites/:site/errors/time-series",
        name: "Get Error Time Series",
        description: "Returns error occurrence counts over time",
        hasCommonParams: true,
        requiredParams: ["errorMessage"],
        specificParams: ["errorMessage", "bucket"],
      },
    ],
  },
  {
    name: "Bots",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/bots/overview",
        name: "Get Bot Overview",
        description: "Returns aggregate bot-traffic metrics with a breakdown by detection layer",
        hasCommonParams: true,
        specificParams: ["layer"],
      },
      {
        method: "GET",
        path: "/sites/:site/bots/time-series",
        name: "Get Bot Time Series",
        description: "Returns bot request counts over time",
        hasCommonParams: true,
        specificParams: ["bucket", "layer", "purpose"],
      },
      {
        method: "GET",
        path: "/sites/:site/bots/ai-summary",
        name: "Get AI Summary",
        description: "Returns crawls and referrals per AI operator, side by side",
        hasCommonParams: true,
      },
      {
        method: "GET",
        path: "/sites/:site/bots/by-dimension",
        name: "Get Bots by Dimension",
        description: "Returns bot requests broken down by a dimension",
        hasCommonParams: true,
        requiredParams: ["dimension"],
        specificParams: ["dimension", "limit", "page", "layer", "purpose"],
        parameterMetadata: {
          dimension: {
            label: "Dimension",
            type: "select",
            options: [
              "browser",
              "browser_version",
              "operating_system",
              "operating_system_version",
              "country",
              "region",
              "city",
              "device_type",
              "referrer",
              "hostname",
              "pathname",
              "dimensions",
              "asn_org",
              "asn_provider",
              "bot_category",
              "bot_name",
              "bot_operator",
              "bot_purpose",
              "matched_ua_pattern",
            ],
          },
        },
      },
    ],
  },
  {
    name: "Goals",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/goals",
        name: "Get Goals",
        description: "Returns paginated list of goals with conversion metrics",
        hasCommonParams: true,
        specificParams: ["page", "page_size", "sort", "order"],
      },
      {
        method: "GET",
        path: "/sites/:site/goals/time-series",
        name: "Get Goal Time Series",
        description: "Returns goal conversions and conversion rate over time",
        hasCommonParams: true,
        requiredParams: ["goal_ids"],
        specificParams: ["goal_ids", "bucket"],
      },
      {
        method: "GET",
        path: "/sites/:site/goals/:goalId/sessions",
        name: "Get Goal Sessions",
        description: "Returns sessions that completed a specific goal",
        hasCommonParams: true,
        pathParams: ["goalId"],
        specificParams: ["page", "limit"],
      },
      {
        method: "POST",
        path: "/sites/:site/goals",
        name: "Create Goal",
        description: "Creates a new goal",
        hasCommonParams: false,
        hasRequestBody: true,
        requestBodyExample: {
          name: "My Goal",
          goalType: "path",
          config: {
            pathPattern: "/checkout/success",
          },
        },
      },
      {
        method: "PUT",
        path: "/sites/:site/goals/:goalId",
        name: "Update Goal",
        description: "Updates an existing goal",
        hasCommonParams: false,
        pathParams: ["goalId"],
        hasRequestBody: true,
        requestBodyExample: {
          name: "Updated Goal",
          goalType: "event",
          config: {
            eventName: "purchase",
          },
        },
      },
      {
        method: "DELETE",
        path: "/sites/:site/goals/:goalId",
        name: "Delete Goal",
        description: "Deletes a goal",
        hasCommonParams: false,
        pathParams: ["goalId"],
      },
    ],
  },
  {
    name: "Funnels",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/funnels",
        name: "Get Funnels",
        description: "Returns all saved funnels for a site",
        hasCommonParams: false,
      },
      {
        method: "POST",
        path: "/sites/:site/funnels/analyze",
        name: "Analyze Funnel",
        description: "Analyzes funnel conversion data step-by-step",
        hasCommonParams: true,
        hasRequestBody: true,
        requestBodyExample: {
          steps: [
            { type: "page", value: "/", name: "Homepage" },
            { type: "page", value: "/pricing", name: "Pricing" },
            { type: "page", value: "/signup", name: "Signup" },
          ],
        },
      },
      {
        method: "POST",
        path: "/sites/:site/funnels/:stepNumber/sessions",
        name: "Get Funnel Step Sessions",
        description: "Returns sessions that reached or dropped at a specific funnel step",
        hasCommonParams: true,
        pathParams: ["stepNumber"],
        specificParams: ["mode", "page", "limit"],
        requiredParams: ["mode"],
        parameterMetadata: {
          mode: { label: "Mode", type: "select", options: ["reached", "dropped"] },
        },
        hasRequestBody: true,
        requestBodyExample: {
          steps: [
            { type: "page", value: "/", name: "Homepage" },
            { type: "page", value: "/pricing", name: "Pricing" },
          ],
        },
      },
      {
        method: "POST",
        path: "/sites/:site/funnels",
        name: "Create Funnel",
        description: "Creates a saved funnel",
        hasCommonParams: false,
        hasRequestBody: true,
        requestBodyExample: {
          name: "Conversion Funnel",
          steps: [
            { type: "page", value: "/", name: "Homepage" },
            { type: "page", value: "/signup", name: "Signup" },
          ],
        },
      },
      {
        method: "DELETE",
        path: "/sites/:site/funnels/:funnelId",
        name: "Delete Funnel",
        description: "Deletes a saved funnel",
        hasCommonParams: false,
        pathParams: ["funnelId"],
      },
    ],
  },
  {
    name: "Performance",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/performance/overview",
        name: "Get Performance Overview",
        description: "Returns aggregate Core Web Vitals metrics",
        hasCommonParams: true,
      },
      {
        method: "GET",
        path: "/sites/:site/performance/time-series",
        name: "Get Performance Time Series",
        description: "Returns performance metrics over time",
        hasCommonParams: true,
        specificParams: ["bucket"],
      },
      {
        method: "GET",
        path: "/sites/:site/performance/by-dimension",
        name: "Get Performance by Dimension",
        description: "Returns performance breakdown by dimension",
        hasCommonParams: true,
        requiredParams: ["dimension"],
        specificParams: ["dimension", "page", "limit", "sort_by", "sort_order"],
        parameterMetadata: {
          dimension: {
            label: "Dimension",
            type: "select",
            options: ["pathname", "country", "region", "browser", "operating_system", "device_type"],
          },
          sort_by: {
            label: "Sort By",
            type: "select",
            options: [
              "pathname",
              "country",
              "region",
              "browser",
              "operating_system",
              "device_type",
              "event_count",
              "lcp_avg",
              "lcp_p50",
              "lcp_p75",
              "lcp_p90",
              "lcp_p99",
              "cls_avg",
              "cls_p50",
              "cls_p75",
              "cls_p90",
              "cls_p99",
              "inp_avg",
              "inp_p50",
              "inp_p75",
              "inp_p90",
              "inp_p99",
              "fcp_avg",
              "fcp_p50",
              "fcp_p75",
              "fcp_p90",
              "fcp_p99",
              "ttfb_avg",
              "ttfb_p50",
              "ttfb_p75",
              "ttfb_p90",
              "ttfb_p99",
            ],
          },
        },
      },
    ],
  },
  {
    name: "Sessions",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/sessions",
        name: "Get Sessions",
        description: "Returns a paginated list of sessions",
        hasCommonParams: true,
        specificParams: [
          "page",
          "limit",
          "user_id",
          "session_id",
          "identified_only",
          "min_pageviews",
          "min_events",
          "min_duration",
        ],
      },
      {
        method: "GET",
        path: "/sites/:site/sessions/:sessionId",
        name: "Get Session",
        description: "Returns detailed session information with events",
        hasCommonParams: false,
        pathParams: ["sessionId"],
        specificParams: ["limit", "offset", "minutes"],
      },
      {
        method: "GET",
        path: "/sites/:site/sessions/locations",
        name: "Get Session Locations",
        description: "Returns aggregated session locations for map visualization",
        hasCommonParams: true,
      },
    ],
  },
  {
    name: "Session Replay",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/session-replay/list",
        name: "Get Session Replays",
        description: "Returns session replay recordings with pagination",
        hasCommonParams: true,
        specificParams: ["limit", "offset", "userId", "minDuration"],
      },
      {
        method: "GET",
        path: "/sites/:site/session-replay/:sessionId",
        name: "Get Session Replay Events",
        description: "Returns rrweb events and metadata for a session replay",
        hasCommonParams: false,
        pathParams: ["sessionId"],
      },
      {
        method: "DELETE",
        path: "/sites/:site/session-replay/:sessionId",
        name: "Delete Session Replay",
        description: "Deletes a session replay recording",
        hasCommonParams: false,
        pathParams: ["sessionId"],
      },
    ],
  },
  {
    name: "Users",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/users",
        name: "Get Users",
        description: "Returns a paginated list of users",
        hasCommonParams: true,
        specificParams: ["page", "page_size", "sort_by", "sort_order", "identified_only", "search", "search_field"],
        parameterMetadata: {
          sort_by: {
            label: "Sort By",
            type: "select",
            options: ["first_seen", "last_seen", "pageviews", "sessions", "events"],
          },
        },
      },
      {
        method: "GET",
        path: "/sites/:site/users/session-count",
        name: "Get User Session Count",
        description: "Returns daily session counts for a specific user",
        hasCommonParams: false,
        requiredParams: ["user_id"],
        specificParams: ["user_id", "time_zone"],
      },
      {
        method: "GET",
        path: "/sites/:site/users/:userId",
        name: "Get User Info",
        description: "Returns detailed user profile information",
        hasCommonParams: false,
        pathParams: ["userId"],
      },
    ],
  },
  {
    name: "User Traits",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/user-traits/keys",
        name: "Get User Trait Keys",
        description: "Returns known user trait keys with user counts",
        hasCommonParams: false,
      },
      {
        method: "GET",
        path: "/sites/:site/user-traits/values",
        name: "Get User Trait Values",
        description: "Returns values for a user trait key",
        hasCommonParams: false,
        requiredParams: ["key"],
        specificParams: ["key", "limit", "offset"],
      },
      {
        method: "GET",
        path: "/sites/:site/user-traits/users",
        name: "Get Users by Trait",
        description: "Returns users matching a trait key and value",
        hasCommonParams: false,
        requiredParams: ["key", "value"],
        specificParams: ["key", "value", "limit", "offset"],
      },
    ],
  },
  {
    name: "Misc",
    endpoints: [
      {
        method: "GET",
        path: "/sites/:site/retention",
        name: "Get Retention",
        description: "Returns cohort-based retention analysis",
        hasCommonParams: true,
        specificParams: ["mode", "range"],
        parameterMetadata: {
          mode: { label: "Mode", type: "select", options: ["day", "week"] },
        },
      },
      {
        method: "GET",
        path: "/sites/:site/journeys",
        name: "Get Journeys",
        description: "Returns most common page navigation paths",
        hasCommonParams: true,
        specificParams: ["steps", "limit", "stepFilters"],
      },
      {
        method: "GET",
        path: "/org-event-count/:organizationId",
        name: "Get Organization Event Count",
        description: "Returns daily event usage counts for an organization",
        hasCommonParams: false,
        pathParams: ["organizationId"],
        specificParams: ["start_date", "end_date", "time_zone"],
      },
    ],
  },
];

// Flatten all endpoints for easy lookup
export const allEndpoints: EndpointConfig[] = endpointCategories.flatMap(cat => cat.endpoints);

// Parameter metadata for dynamic form generation
export const parameterMetadata: Record<string, ParameterMetadata> = {
  bucket: {
    label: "Bucket",
    type: "select",
    options: ["minute", "five_minutes", "ten_minutes", "fifteen_minutes", "hour", "day", "week", "month", "year"],
  },
  parameter: {
    label: "Parameter",
    type: "select",
    options: [
      "pathname",
      "page_title",
      "querystring",
      "hostname",
      "user_id",
      "event_name",
      "referrer",
      "channel",
      "entry_page",
      "exit_page",
      "country",
      "region",
      "city",
      "device_type",
      "operating_system",
      "operating_system_version",
      "browser",
      "browser_version",
      "language",
      "dimensions",
      "utm_source",
      "utm_medium",
      "utm_campaign",
      "utm_term",
      "utm_content",
      "tag",
      "lat",
      "lon",
      "timezone",
    ],
  },
  dimension: {
    label: "Dimension",
    type: "select",
    options: ["pathname", "country", "region", "browser", "operating_system", "device_type"],
  },
  layer: {
    label: "Layer",
    type: "select",
    options: ["ua_pattern", "header_heuristics", "client_signals", "bot_asn", "rate_anomaly"],
  },
  purpose: {
    label: "Purpose",
    type: "select",
    // "ai" and "ai_crawler" are groups; the rest are the stored values.
    options: [
      "ai",
      "ai_crawler",
      "ai_training",
      "ai_search",
      "ai_agent",
      "search",
      "social_preview",
      "seo",
      "monitoring",
      "security",
      "scripted",
      "headless",
    ],
  },
  mode: {
    label: "Mode",
    type: "select",
    options: ["day", "week", "reached", "dropped"],
  },
  sort: {
    label: "Sort By",
    type: "select",
    options: ["goalId", "name", "goalType", "createdAt"],
  },
  sort_by: {
    label: "Sort By",
    type: "select",
    options: ["first_seen", "last_seen", "pageviews", "sessions", "events"],
  },
  sort_order: {
    label: "Sort Order",
    type: "select",
    options: ["asc", "desc"],
  },
  order: {
    label: "Order",
    type: "select",
    options: ["asc", "desc"],
  },
  page: { label: "Page", type: "number", placeholder: "1" },
  limit: { label: "Limit", type: "number", placeholder: "10" },
  page_size: { label: "Page Size", type: "number", placeholder: "10" },
  min_pageviews: { label: "Min Pageviews", type: "number", placeholder: "0" },
  min_events: { label: "Min Events", type: "number", placeholder: "0" },
  min_duration: { label: "Min Duration (s)", type: "number", placeholder: "0" },
  minDuration: { label: "Min Duration (s)", type: "number", placeholder: "30" },
  minutes: { label: "Minutes", type: "number", placeholder: "5" },
  steps: { label: "Steps", type: "number", placeholder: "3" },
  stepFilters: { label: "Step Filters", type: "text", placeholder: 'JSON, e.g. {"1":"/pricing"}' },
  range: { label: "Range (days)", type: "number", placeholder: "90" },
  offset: { label: "Offset", type: "number", placeholder: "0" },
  start_date: { label: "Start Date", type: "text", placeholder: "YYYY-MM-DD" },
  end_date: { label: "End Date", type: "text", placeholder: "YYYY-MM-DD" },
  since_timestamp: { label: "Since Timestamp", type: "text", placeholder: "ISO 8601, e.g. 2024-01-31T14:00:00.000Z" },
  before_timestamp: { label: "Before Timestamp", type: "text", placeholder: "ISO 8601, e.g. 2024-01-31T14:00:00.000Z" },
  event_name: { label: "Event Name", type: "text", placeholder: "e.g., purchase" },
  errorMessage: { label: "Error Message", type: "text", placeholder: "Error message to filter by" },
  user_id: { label: "User ID", type: "text", placeholder: "User ID" },
  userId: { label: "User ID", type: "text", placeholder: "User ID" },
  session_id: { label: "Session ID", type: "text", placeholder: "Session ID" },
  key: { label: "Key", type: "text", placeholder: "Trait key" },
  value: { label: "Value", type: "text", placeholder: "Trait value" },
  search: { label: "Search", type: "text", placeholder: "Search users" },
  search_field: { label: "Search Field", type: "select", options: ["username", "name", "email", "user_id"] },
  time_zone: { label: "Time Zone", type: "text", placeholder: "America/New_York" },
  identified_only: { label: "Identified Only", type: "select", options: ["true", "false"] },
  // Path params
  orgId: { label: "Organization ID", type: "text", placeholder: "org_abc123" },
  goalId: { label: "Goal ID", type: "number", placeholder: "Goal ID" },
  goal_ids: { label: "Goal IDs", type: "text", placeholder: "e.g. 1,2" },
  funnelId: { label: "Funnel ID", type: "number", placeholder: "Funnel ID" },
  teamId: { label: "Team ID", type: "text", placeholder: "team_abc123" },
  sessionId: { label: "Session ID", type: "text", placeholder: "Session ID" },
  stepNumber: { label: "Step Number", type: "number", placeholder: "Step number (1-indexed)" },
  siteId: { label: "Site ID", type: "number", placeholder: "Site ID" },
  organizationId: { label: "Organization ID", type: "text", placeholder: "org_abc123" },
  // Sites-specific params
  action: {
    label: "Action",
    type: "select",
    options: ["generate_private_link_key", "revoke_private_link_key"],
  },
  // Organizations-specific params
  role: {
    label: "Role",
    type: "select",
    options: ["admin", "member", "owner"],
  },
};

// Method colors for UI
export const methodColors: Record<HttpMethod, string> = {
  GET: "bg-green-500/20 text-green-600 dark:text-green-400",
  POST: "bg-blue-500/20 text-blue-600 dark:text-blue-400",
  PUT: "bg-yellow-500/20 text-yellow-600 dark:text-yellow-400",
  DELETE: "bg-red-500/20 text-red-600 dark:text-red-400",
};