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

# Analyst Insights Stream

> Real-time analyst insights, ratings, and price targets for securities.

## Overview

Subscribe to real-time analyst insights and receive updates on analyst ratings, price targets, and detailed recommendations as they happen.

### Key Features

* **Real-time Updates**: Get instant notifications when analysts publish new insights or update existing ratings
* **Filter by Security**: Subscribe to specific tickers or ISINs to receive only relevant data
* **Comprehensive Data**: Includes analyst firm details, ratings, price targets, and detailed insights
* **Action Tracking**: Monitor when insights are created, updated, or removed

### Use Cases

* Track analyst sentiment changes for portfolio securities
* Build real-time alerts for rating upgrades or downgrades
* Monitor price target changes across multiple analysts
* Aggregate consensus insights from multiple analyst firms

## Quick Start

Use the interactive WebSocket tester above to connect and test the stream in real-time.

### Connection URL

```
wss://api.benzinga.com/api/v1/analyst/insights/stream?token=YOUR_TOKEN
```

### Query Parameters

| Parameter | Required | Description                                                |
| --------- | -------- | ---------------------------------------------------------- |
| `token`   | Yes      | Your Benzinga WebSocket API token (bz.production\*\*\*)    |
| `tickers` | No       | Comma-separated list of ticker symbols (e.g., `AAPL,MSFT`) |
| `isins`   | No       | Comma-separated list of ISINs to filter                    |

## Message Example

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "api_version": "websocket/v1",
  "kind": "stream_type",
  "data": {
    "action": "created",
    "id": "insight-id",
    "timestamp": "2024-10-08T10:00:00Z",
    "content": {
      "action": "Upgrades",
      "analyst_insights": "The analyst has upgraded the stock...",
      "firm": "Goldman Sachs",
      "pt": "150.00",
      "rating": "Buy",
      "security": {
        "symbol": "AAPL",
        "name": "Apple Inc.",
        "exchange": "NASDAQ"
      }
    }
  }
}
```

### Message Actions

| Action                | Description                   |
| --------------------- | ----------------------------- |
| `created` / `Created` | New analyst insight published |
| `updated` / `Updated` | Existing insight modified     |
| `deleted` / `Deleted` | Insight removed               |

## Interactive Commands

| Command  | Description                                  |
| -------- | -------------------------------------------- |
| `ping`   | Keep connection alive (responds with `pong`) |
| `replay` | Replay up to the last 100 cached messages    |

## Best Practices

* **Deduplication**: Use the `id` field to prevent processing duplicate messages
* **Heartbeat**: Send `ping` commands every 30-60 seconds to maintain connection
* **Error Handling**: Implement reconnection logic with exponential backoff
* **Filtering**: Use ticker/ISIN filters to reduce bandwidth


## AsyncAPI

````yaml asyncapi/analyst-insights-stream.yml analystInsights
id: analystInsights
title: Analyst insights
description: Send action commands; receive real-time analyst insights
servers:
  - id: production
    protocol: wss
    host: api.benzinga.com/api/v1/analyst/insights
    bindings: []
    variables: []
address: stream
parameters: []
bindings: []
operations:
  - &ref_2
    id: analystInsights.publish
    title: Analyst insights.publish
    description: Send commands to the server
    type: receive
    messages:
      - &ref_4
        id: publish
        contentType: text/plain
        payload:
          - type: string
            enum: &ref_0
              - ping
              - replay
            description: Send action commands (ping, replay)
            x-parser-schema-id: <anonymous-schema-1>
            name: publish
        headers: []
        jsonPayloadSchema:
          type: string
          enum: *ref_0
          description: Action to perform (ping for heartbeat, replay for message history)
          x-parser-schema-id: <anonymous-schema-1>
        title: Publish
        description: Send action commands (ping, replay)
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: publish
          - id: x-parser-message-name
            value: ActionRequest
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: analystInsights
  - &ref_3
    id: analystInsights.subscribe
    title: Analyst insights.subscribe
    description: Receive real-time analyst insights
    type: send
    messages:
      - &ref_5
        id: subscribe
        contentType: application/json
        payload:
          - name: subscribe
            description: Analyst insight event
            type: object
            properties:
              - name: id
                type: string
                description: Unique UUID for the websocket response
                required: true
              - name: api_version
                type: string
                description: Websocket API version
                enumValues:
                  - websocket/v1
                required: true
              - name: kind
                type: string
                description: Websocket connection stream type
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: action
                    type: string
                    description: Websocket data action
                    enumValues:
                      - created
                      - updated
                      - deleted
                      - Created
                      - Updated
                      - Deleted
                    required: false
                  - name: id
                    type: string
                    description: Data ID for the analyst insight
                    required: false
                  - name: timestamp
                    type: string
                    description: Timestamp of the data
                    required: false
                  - name: content
                    type: object
                    required: false
                    properties:
                      - name: action
                        type: string
                        description: >-
                          Analyst's action on the stock (e.g., Maintains,
                          Upgrades)
                        required: false
                      - name: analyst_insights
                        type: string
                        description: Detailed insights from the analyst
                        required: false
                      - name: date
                        type: string
                        description: Date of the analyst insight
                        required: false
                      - name: firm
                        type: string
                        description: Name of the firm providing the insight
                        required: false
                      - name: firm_id
                        type: string
                        description: Unique identifier for the firm
                        required: false
                      - name: id
                        type: string
                        description: Unique identifier for the analyst insight
                        required: false
                      - name: pt
                        type: string
                        description: Price target given by the analyst
                        required: false
                      - name: rating
                        type: string
                        description: Rating provided by the analyst
                        required: false
                      - name: rating_id
                        type: string
                        description: Unique identifier for the rating
                        required: false
                      - name: security
                        type: object
                        required: false
                        properties:
                          - name: cik
                            type: string
                            description: Central Index Key of the security
                            required: false
                          - name: exchange
                            type: string
                            description: Exchange where the security is listed
                            required: false
                          - name: isin
                            type: string
                            description: International Securities Identification Number
                            required: false
                          - name: name
                            type: string
                            description: Name of the security
                            required: false
                          - name: symbol
                            type: string
                            description: Ticker symbol of the security
                            required: false
                      - name: updated
                        type: integer
                        description: Timestamp of when the insight was last updated
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - api_version
            - kind
            - data
          properties:
            id:
              type: string
              format: uuid
              description: Unique UUID for the websocket response
              x-parser-schema-id: <anonymous-schema-3>
            api_version:
              type: string
              enum:
                - websocket/v1
              description: Websocket API version
              x-parser-schema-id: <anonymous-schema-4>
            kind:
              type: string
              description: Websocket connection stream type
              x-parser-schema-id: <anonymous-schema-5>
            data:
              type: object
              required:
                - action
                - id
                - content
                - timestamp
              properties:
                action:
                  type: string
                  enum:
                    - created
                    - updated
                    - deleted
                    - Created
                    - Updated
                    - Deleted
                  description: Websocket data action
                  x-parser-schema-id: <anonymous-schema-7>
                id:
                  type: string
                  description: Data ID for the analyst insight
                  x-parser-schema-id: <anonymous-schema-8>
                timestamp:
                  type: string
                  format: date-time
                  description: Timestamp of the data
                  x-parser-schema-id: <anonymous-schema-9>
                content:
                  type: object
                  properties:
                    action:
                      type: string
                      description: >-
                        Analyst's action on the stock (e.g., Maintains,
                        Upgrades)
                      x-parser-schema-id: <anonymous-schema-11>
                    analyst_insights:
                      type: string
                      description: Detailed insights from the analyst
                      x-parser-schema-id: <anonymous-schema-12>
                    date:
                      type: string
                      format: date
                      description: Date of the analyst insight
                      x-parser-schema-id: <anonymous-schema-13>
                    firm:
                      type: string
                      description: Name of the firm providing the insight
                      x-parser-schema-id: <anonymous-schema-14>
                    firm_id:
                      type: string
                      description: Unique identifier for the firm
                      x-parser-schema-id: <anonymous-schema-15>
                    id:
                      type: string
                      format: uuid
                      description: Unique identifier for the analyst insight
                      x-parser-schema-id: <anonymous-schema-16>
                    pt:
                      type: string
                      description: Price target given by the analyst
                      x-parser-schema-id: <anonymous-schema-17>
                    rating:
                      type: string
                      description: Rating provided by the analyst
                      x-parser-schema-id: <anonymous-schema-18>
                    rating_id:
                      type: string
                      description: Unique identifier for the rating
                      x-parser-schema-id: <anonymous-schema-19>
                    security:
                      type: object
                      properties:
                        cik:
                          type: string
                          description: Central Index Key of the security
                          x-parser-schema-id: <anonymous-schema-21>
                        exchange:
                          type: string
                          description: Exchange where the security is listed
                          x-parser-schema-id: <anonymous-schema-22>
                        isin:
                          type: string
                          description: International Securities Identification Number
                          x-parser-schema-id: <anonymous-schema-23>
                        name:
                          type: string
                          description: Name of the security
                          x-parser-schema-id: <anonymous-schema-24>
                        symbol:
                          type: string
                          description: Ticker symbol of the security
                          x-parser-schema-id: <anonymous-schema-25>
                      x-parser-schema-id: <anonymous-schema-20>
                    updated:
                      type: integer
                      format: int64
                      description: Timestamp of when the insight was last updated
                      x-parser-schema-id: <anonymous-schema-26>
                  x-parser-schema-id: <anonymous-schema-10>
              x-parser-schema-id: <anonymous-schema-6>
          x-parser-schema-id: <anonymous-schema-2>
        title: Subscribe
        description: Analyst insight event
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
          - id: x-parser-message-name
            value: AnalystInsightMessage
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: analystInsights
securitySchemes:
  - id: tokenAuth
    name: token
    type: httpApiKey
    description: Benzinga WebSocket API token (bz.production***)
    in: query
    extensions: []

````