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

# Metrics for casts

> Fetches metrics casts matching a query

## Node.js SDK

🔗 **SDK Method:** [fetchCastMetrics](/nodejs-sdk/metric-apis/fetchCastMetrics)

Use this API endpoint with the Neynar Node.js SDK for typed responses and better developer experience.


## OpenAPI

````yaml get /v2/farcaster/cast/metrics/
openapi: 3.0.4
info:
  contact:
    email: team@neynar.com
    name: Neynar
    url: https://neynar.com/
  description: >-
    The Neynar API allows you to interact with the Farcaster protocol among
    other things. See the [Neynar docs](https://docs.neynar.com/reference) for
    more details.
  title: Neynar API
  version: 3.173.0
servers:
  - url: https://api.neynar.com
security:
  - ApiKeyAuth: []
tags:
  - description: Operations related to user
    externalDocs:
      description: More info about user
      url: https://docs.neynar.com/reference/user-operations
    name: User
  - description: Operations related to signer
    externalDocs:
      description: More info about signer
      url: https://docs.neynar.com/reference/signer-operations
    name: Signer
  - description: Operations related to cast
    externalDocs:
      description: More info about cast
      url: https://docs.neynar.com/reference/cast-operations
    name: Cast
  - description: Operations related to feed
    externalDocs:
      description: More info about feed
      url: https://docs.neynar.com/reference/feed-operations
    name: Feed
  - description: Operations related to reaction
    externalDocs:
      description: More info about reaction
      url: https://docs.neynar.com/reference/reaction-operations
    name: Reaction
  - description: Operations related to notifications
    externalDocs:
      description: More info about notifications
      url: https://docs.neynar.com/reference/notifications-operations
    name: Notifications
  - description: Operations related to channels
    externalDocs:
      description: More info about channels
      url: https://docs.neynar.com/reference/channel-operations
    name: Channel
  - description: Operations related to follows
    externalDocs:
      description: More info about follows
      url: https://docs.neynar.com/reference/follows-operations
    name: Follows
  - description: Operations related to storage
    externalDocs:
      description: More info about storage
      url: https://docs.neynar.com/reference/storage-operations
    name: Storage
  - description: Operations related to mini apps
    name: Frame
  - description: Operations for building AI agents
    name: Agents
  - description: Operations related to fname
    name: fname
  - description: Operations related to a webhook
    name: Webhook
  - description: >-
      Securely communicate and perform actions on behalf of users across
      different apps
    externalDocs:
      description: More info about farcaster actions
      url: https://docs.neynar.com/docs/farcaster-actions-spec
    name: Action
  - description: Operations related to a subscriptions
    name: Subscribers
  - description: Operations related to a mute
    name: Mute
  - description: Operations related to a block
    name: Block
  - description: Operations related to a ban
    name: Ban
  - description: Operations related to onchain data
    name: Onchain
  - description: Operations related to login
    name: Login
  - description: Operations related to retrieving metrics
    name: Metrics
  - description: Operations related to mini app host notifications
    externalDocs:
      description: More info about mini app host notifications
      url: https://docs.neynar.com/docs/app-host-notifications
    name: App Host
paths:
  /v2/farcaster/cast/metrics/:
    get:
      tags:
        - Metrics
      summary: Metrics for casts
      description: Fetches metrics casts matching a query
      operationId: fetch-cast-metrics
      parameters:
        - $ref: '#/components/parameters/NeynarExperimentalHeader'
        - description: Query string to search for casts
          in: query
          name: q
          required: true
          schema:
            example: star wars
            type: string
        - description: Interval of time for which to fetch metrics. Default is 30d.
          in: query
          name: interval
          schema:
            enum:
              - 1d
              - 7d
              - 30d
              - 90d
              - 180d
            type: string
        - description: Fid of the user whose casts you want to search
          in: query
          name: author_fid
          schema:
            minimum: 1
            type: integer
        - description: Channel ID of the casts you want to search
          in: query
          name: channel_id
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CastsMetricsResponse'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorRes'
          description: Bad Request
      externalDocs:
        url: https://docs.neynar.com/reference/fetch-cast-metrics
components:
  parameters:
    NeynarExperimentalHeader:
      description: >-
        Enables experimental features including filtering based on the Neynar
        score. See
        [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a)
        for more details.
      in: header
      name: x-neynar-experimental
      schema:
        default: false
        type: boolean
      x-is-global-header: true
  schemas:
    CastsMetricsResponse:
      properties:
        metrics:
          items:
            $ref: '#/components/schemas/CastsMetrics'
          type: array
      required:
        - metrics
      title: CastsMetricsResponse
      type: object
    ErrorRes:
      description: Details for the error response
      properties:
        code:
          type: string
        message:
          type: string
        property:
          type: string
        status:
          format: int32
          type: integer
      required:
        - message
      title: ErrorRes
      type: object
    CastsMetrics:
      properties:
        cast_count:
          format: int32
          type: integer
        resolution_in_seconds:
          format: int32
          type: integer
        start:
          format: date-time
          type: string
      required:
        - start
        - resolution_in_seconds
        - cast_count
      title: CastsMetrics
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: API key to authorize requests
      in: header
      name: x-api-key
      type: apiKey
      x-default: NEYNAR_API_DOCS

````