> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hooked.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Niche Metrics

> Get performance metrics and analytics for a content niche

## Overview

This endpoint returns detailed performance metrics and analytics for a specific content niche, including daily trends, platform breakdowns, and top hashtags.

### Path Parameters

<ParamField path="nicheId" type="string" required>
  The niche identifier (e.g., "fitness", "cooking", "gaming")
</ParamField>

### Query Parameters

<ParamField query="days" type="number" default="7">
  Number of days of historical data to include (1-30)
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="niche" type="object">
      Niche information including id, label, emoji, and description
    </ResponseField>

    <ResponseField name="period" type="object">
      Time period information (days, startDate, endDate)
    </ResponseField>

    <ResponseField name="summary" type="object">
      Aggregated metrics for the period

      <Expandable title="summary">
        <ResponseField name="totalVideos" type="number">
          Total videos in the period
        </ResponseField>

        <ResponseField name="totalViews" type="number">
          Total view count
        </ResponseField>

        <ResponseField name="totalLikes" type="number">
          Total like count
        </ResponseField>

        <ResponseField name="totalComments" type="number">
          Total comment count
        </ResponseField>

        <ResponseField name="totalShares" type="number">
          Total share count
        </ResponseField>

        <ResponseField name="avgViralScore" type="number">
          Average viral score
        </ResponseField>

        <ResponseField name="avgEngagementRate" type="number">
          Average engagement rate
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="platforms" type="object">
      Platform-specific breakdown of videos and views
    </ResponseField>

    <ResponseField name="dailyMetrics" type="array">
      Daily metrics with views, likes, comments, shares, and platform breakdowns
    </ResponseField>

    <ResponseField name="topHashtags" type="array">
      Most used hashtags in this niche with usage counts
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.hooked.so/v1/niche/fitness/metrics?days=7" \
    -H "x-api-key: your_api_key_here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.hooked.so/v1/niche/fitness/metrics?days=7', {
    headers: {
      'x-api-key': 'your_api_key_here'
    }
  });

  const data = await response.json();
  console.log(data.data.summary);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.hooked.so/v1/niche/fitness/metrics',
      params={'days': 7},
      headers={'x-api-key': 'your_api_key_here'}
  )

  metrics = response.json()['data']
  print(f"Total views: {metrics['summary']['totalViews']}")
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "niche": {
        "id": "fitness",
        "label": "Fitness",
        "emoji": "💪",
        "description": "Workout routines, fitness tips, and gym content"
      },
      "period": {
        "days": 7,
        "startDate": "2024-01-08T00:00:00Z",
        "endDate": "2024-01-15T00:00:00Z"
      },
      "summary": {
        "totalVideos": 245,
        "totalViews": 156000000,
        "totalLikes": 12500000,
        "totalComments": 890000,
        "totalShares": 2300000,
        "avgViralScore": 72.5,
        "avgEngagementRate": 10.2
      },
      "platforms": {
        "tiktok": {
          "videos": 180,
          "views": 120000000
        },
        "youtube": {
          "videos": 65,
          "views": 36000000
        }
      },
      "dailyMetrics": [
        {
          "date": "2024-01-15",
          "views": 23000000,
          "likes": 1800000,
          "comments": 125000,
          "shares": 340000,
          "videos": 35,
          "avgViralScore": 74.2,
          "avgEngagement": 10.8,
          "platforms": {
            "tiktok": { "views": 18000000, "videos": 26 },
            "youtube": { "views": 5000000, "videos": 9 }
          }
        }
      ],
      "topHashtags": [
        { "hashtag": "fitness", "count": 189 },
        { "hashtag": "workout", "count": 156 },
        { "hashtag": "gym", "count": 134 },
        { "hashtag": "fitnessmotivation", "count": 98 },
        { "hashtag": "training", "count": 87 }
      ]
    }
  }
  ```
</ResponseExample>

## Use Cases

<AccordionGroup>
  <Accordion title="Track niche performance over time" icon="chart-line">
    Use the `dailyMetrics` array to visualize trends and identify the best days for posting.

    ```javascript theme={null}
    const bestDay = dailyMetrics.reduce((best, day) =>
      day.avgEngagement > best.avgEngagement ? day : best
    );
    console.log(`Best day: ${bestDay.date} with ${bestDay.avgEngagement}% engagement`);
    ```
  </Accordion>

  <Accordion title="Compare platform performance" icon="balance-scale">
    Use the `platforms` breakdown to understand where your niche performs best.

    ```python theme={null}
    platforms = metrics['platforms']
    if platforms['tiktok']['views'] > platforms['youtube']['views']:
        print("TikTok is performing better in this niche")
    ```
  </Accordion>

  <Accordion title="Discover trending hashtags" icon="hashtag">
    Use `topHashtags` to find the most effective hashtags for your content.
  </Accordion>
</AccordionGroup>

<Tip>
  Combine niche metrics with the [Niche Videos](/api-reference/niche/videos) endpoint to identify what makes content go viral in your target category.
</Tip>


## OpenAPI

````yaml GET /v1/niche/{nicheId}/metrics
openapi: 3.0.0
info:
  title: Hooked API
  version: 1.0.0
  description: AI Video Generation API
servers:
  - url: https://api.hooked.so
security:
  - ApiKeyAuth: []
paths:
  /v1/niche/{nicheId}/metrics:
    get:
      tags:
        - Niches
      summary: Niche Metrics
      description: Get performance metrics and analytics for a content niche
      operationId: getNicheMetrics
      parameters:
        - name: nicheId
          in: path
          required: true
          schema:
            type: string
        - name: days
          in: query
          schema:
            type: integer
            default: 7
      responses:
        '200':
          description: Success
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````