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

# Average rating

> Get current rating and target price averaged across all analysts opinions

<ResponseExample>
  ```json Response example for AAPL theme={null}
  "data": {
      "analysts_ratings": {
          "count": 50,
          "buy": 32,
          "hold": 14,
          "sell": 4,
          "average_rating": "Buy"
      },
      "target_price": {
          "count": 16,
          "high": 300.0,
          "average": 226.97625,
          "low": 170.0
      }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml reference/analysis-ratings/analysis-ratings.yaml GET /analysis-ratings/consensus
openapi: 3.1.0
info:
  title: Analyst ratings and target prices
  description: Get analyst ratings and target prices
  version: 1.0.0
servers:
  - url: https://openapi.ainvest.com/open
    description: Production environment
security:
  - bearerAuth: []
tags:
  - name: Analyst Ratings
    description: Analyst ratings and target prices
    externalDocs:
      url: https://docs.ainvest.com/analysis-ratings
paths:
  /analysis-ratings/consensus:
    get:
      tags:
        - Analyst Ratings
      summary: Get current rating and target price
      description: >-
        Get current rating and target price averaged across all analysts
        opinions
      operationId: getAnalystRatingsConsensus
      parameters:
        - name: ticker
          in: query
          required: true
          description: US stock market ticker symbol, e.g. AAPL, TSLA, etc.
          schema:
            type: string
      responses:
        '200':
          description: Successful response in standard envelope
          content:
            application/json:
              schema:
                $schema: http://json-schema.org/draft-04/schema#
                type: object
                properties:
                  data:
                    type: object
                    description: >-
                      Average rating and target price. null if there are no
                      ratings available
                    properties:
                      analysts_ratings:
                        type: object
                        description: Number of analyst ratings for each rating level
                        properties:
                          count:
                            type: integer
                            description: Total number of ratings
                          buy:
                            type: integer
                            description: Number of analysts rating the stock as buy
                          hold:
                            type: integer
                            description: Number of analysts rating the stock as hold
                          sell:
                            type: integer
                            description: Number of analysts rating the stock as sell
                          average_rating:
                            type: string
                            description: Prevailing rating across all analysts
                      target_price:
                        type: object
                        description: Variation of target prices
                        properties:
                          count:
                            type: integer
                            description: Total number of analysts providing target prices
                          high:
                            type: number
                            description: Highest target price
                          average:
                            type: number
                            description: Average target price
                          low:
                            type: number
                            description: Lowest target price
                  status_code:
                    type: number
                    description: Status code, `0` for success
                  status_msg:
                    type: string
                    description: Status message, `success` for success
        '400':
          description: >-
            Validation error, i.e. requested stock is not found or parameter is
            not specified
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status_code: 4012
                status_msg: Invalid param
components:
  schemas:
    Error:
      type: object
      properties:
        status_code:
          type: integer
          description: Business status code
        status_msg:
          type: string
          description: Error message
      required:
        - status_code
        - status_msg
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your key. [Get the key
        here](https://www.ainvest.com/business/developer-manage/)

````