---
title: News tg b
sidebar_position: 5
tags:
  - "API: Beta"
---

:::warning Beta Endpoint
The News endpoint is still in beta and has not yet been optimized for performance. Use caution before adding this endpoint in a prodution environment.
:::

Get news for a stock.

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

## Endpoint
```
https://api.marketdata.app/v1/stocks/news/{symbol}/
```

#### Method
```
GET
```
## Request Example

<Tabs>
<TabItem value="HTTP" label="HTTP" default>

**GET** [https://api.marketdata.app/v1/stocks/news/AAPL/](https://api.marketdata.app/v1/stocks/news/AAPL/)

</TabItem>
<TabItem value="NodeJS" label="NodeJS">

```js title="app.js"
fetch("https://api.marketdata.app/v1/stocks/news/AAPL/")
  .then((res) => {
    console.log(res);
  })
  .catch((err) => {
    console.log(err);
  });
```

</TabItem>
<TabItem value="Python" label="Python">

```python title="app.py"
from marketdata.client import MarketDataClient

client = MarketDataClient()
news = client.stocks.news("AAPL")
print(news)
```

</TabItem>
<TabItem value="Go" label="Go">

```go title="stockNews.go"

import (
  "fmt"

  api "github.com/MarketDataApp/sdk-go"
)

func ExampleStockNewsRequest_get() {
	news, err := StockNews().Symbol("AAPL").Get()
	if err != nil {
		fmt.Print(err)
		return
	}

	for _, article := range news {
		fmt.Println(article)
	}
}
```
</TabItem>
</Tabs>

## Response Example

```json
{
  "s":"ok",
  "symbol": ["AAPL"],
  "headline": ["Whoa, There! Let Apple Stock Take a Breather Before Jumping in Headfirst."],
  "content": ["Apple is a rock-solid company, but this doesn't mean prudent investors need to buy AAPL stock at any price."],
  "source": ["https://investorplace.com/2023/12/whoa-there-let-apple-stock-take-a-breather-before-jumping-in-headfirst/"],
  "publicationDate": ["1703041200"],
  "updated": 1703041200
}
```

## Request Parameters

<Tabs>
<TabItem value="required" label="Required" default>

- **symbol** `string`

  The company's ticker symbol.

</TabItem>
<TabItem value="Optional" label="Optional">

- **from** `date`

  The earliest news to include in the output. If you use countback, `from` is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.

- **to** `date`

  The latest news to include in the output. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.

- **countback** `number`

  Countback will fetch a specific number of news before `to`. If you use `from`, countback is not required.

- **date** `date`

  Retrieve news for a specific day. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.

</TabItem>
</Tabs>

## Response Attributes

<Tabs>
<TabItem value="Success" label="Success" default>

- **s** `string`

  Will always be `ok` when there is data for the symbol requested.

- **symbol** `array[string]`

  The symbol of the stock.

- **headline** `array[string]`

  The headline of the news article.

- **content** `array[string]`

  The content of the article, if available.

  :::tip
  Please be aware that this may or may not include the full content of the news article. Additionally, it may include captions of images, copyright notices, syndication information, and other elements that may not be suitable for reproduction without additional filtering.
  :::

- **source** `array[url]`

  The source URL where the news appeared.

- **publicationDate** `array[date]`

  The date the news was published on the source website.

- **updated** `date`

  The timestamp of the last update to the news data.

</TabItem>
<TabItem value="NoData" label="No Data">

- **s** `string`

  Status will be `no_data` if no news can be found for the symbol.

</TabItem>
<TabItem value="Error" label="Error">

- **s** `string`

  Status will be `error` if the request produces an error response.

- **errmsg** `string`
  An error message.

</TabItem>
</Tabs>

## Usage Information

### Data Availability

This endpoint provides news articles related to stocks. News data is auxiliary data that is updated as articles are published and aggregated.

| User Type | Exchange Entitlement | Data Type |
|-----------|---------------------|------------|
| All Users | Not Required | News/Auxiliary |

### Pricing

The cost of using the news API endpoint is 1 credit per API call.

| Data Type     | Cost Basis                | Credits Required per Unit |
|--------------------|---------------------------|---------------------------|
| News Data    | Per API call         | 1 credit                  |
