CNN API

The CNN API allows you to fetch real-time news articles from various categories like U.S., World, Politics, Business, Health, Entertainment, and more. With this API, you can retrieve the latest headlines and detailed news articles from CNN, making it ideal for integrating news content into applications or websites.
Use esta API do seu agente de IA via MCP
Funciona com OpenClaw, Claude Code/Desktop, Cursor, Windsurf, Cline e qualquer cliente de IA compatível com MCP.
Docs e configuração
Crie uma skill envolvendo este MCP: https://mcp.zylalabs.com/mcp?apikey=YOUR_ZYLA_API_KEY

## How to Use the CNN API: Retrieve News with Ease

The **CNN API** allows developers to access real-time news from one of the world's leading news outlets—CNN. By leveraging this API, you can retrieve categorized news stories, get detailed reports on specific articles, and stay up to date with the latest news across various sectors like politics, business, health, and entertainment. This blog will provide a comprehensive guide on how to call the CNN API using various methods, highlight creative ideas for using the API, and cover the benefits and features of the API.

---

### What is the CNN API?

The **CNN API**, available via the RapidAPI platform, enables access to CNN's latest news headlines and detailed articles. It simplifies retrieving news articles from categories like **US**, **World**, **Politics**, **Entertainment**, and more. The API can be called to extract both short headlines and full article details with images, descriptions, and videos.

---

### Key Features and Benefits

1. **Access to Real-Time News**: Get the latest breaking news across various categories.
2. **Easy Integration**: The API is built on REST, making it easy to integrate with any system that supports HTTP requests.
3. **Detailed News Articles**: The details endpoint provides rich information such as images, headlines, descriptions, word counts, and even related videos.
4. **Flexibility**: The API allows you to filter news by category, ensuring you retrieve the news that’s most relevant to your audience.
5. **Multimedia Support**: Retrieve not just text-based news but also related images and embedded videos.
6. **Use Case Versatility**: Whether you’re building a news aggregation app, a news chatbot, or simply need up-to-date headlines for your website, the CNN API is your go-to tool.

---

### How to Call the CNN API

#### Example 1: Get News by Category

You can fetch the latest news by category using the following cURL command:

```bash
curl --request GET \
--url 'https://cnn-api.p.rapidapi.com/category?url=https%3A%2F%2Fedition.cnn.com%2Fentertainment' \
--header 'x-rapidapi-host: cnn-api.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'
```

This command retrieves the latest entertainment news from CNN. You can replace the URL with other category links to retrieve news from other sections such as **World**, **US**, **Politics**, or **Health**.

##### Example of Categories:
- US: `https://edition.cnn.com/us`
- World: `https://edition.cnn.com/world`
- Politics: `https://edition.cnn.com/politics`
- Business: `https://edition.cnn.com/business`
- Health: `https://edition.cnn.com/health`

---

#### Example 2: Get Detailed News Article

For a deeper look at specific articles, use the "details" endpoint. Here’s how you can retrieve detailed information like the headline, description, images, videos, and article body:

```bash
curl --request GET \
--url 'https://cnn-api.p.rapidapi.com/details?url=https%3A%2F%2Fedition.cnn.com%2F2024%2F07%2F08%2Fpolitics%2Fbiden-fate-political-career%2Findex.html' \
--header 'x-rapidapi-host: cnn-api.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'
```

The response provides:
- **Headline**: Article title.
- **Description**: A short summary of the article.
- **Images**: Thumbnail and main images.
- **Video links**: Embedded videos relevant to the story.
- **Word Count**: Total words in the article.
- **Article Body**: Full content of the article.

##### Example Response (Shortened):
```json
{
"headline": "Biden's fate is on the line in the most critical days of his political career",
"description": "The high-stakes week ahead is critical...",
"thumbnailUrl": "https://media.cnn.com/api/v1/images/stellar/prod/gettyimages-2159959397.jpg",
"articleBody": "The high-stakes week ahead is critical to whether President Joe Biden's..."
}
```

---

### Ideas for Using the CNN API

#### 1. **News Aggregation Websites**
If you're developing a news aggregation platform, you can use the CNN API to fetch top headlines in real-time. By pulling articles from different categories (e.g., politics, health, business), you can keep your readers informed with the latest updates across various sectors.

#### 2. **News-Based Mobile Apps**
Create a mobile app that delivers breaking news and updates. Use push notifications to alert users when new articles in specific categories, like sports or entertainment, are available.

#### 3. **Smart Assistants**
Integrate the CNN API with voice-enabled smart assistants like Alexa or Google Assistant, providing users with instant access to news updates on demand.

#### 4. **Custom Newsletters**
Use the API to curate daily or weekly email newsletters for your audience. You can filter articles by categories relevant to their interests and provide them with the most recent news right in their inbox.

#### 5. **Chatbots**
Create an intelligent chatbot that can answer user queries about current events, retrieve the latest news articles, and share breaking headlines. This is useful for customer service platforms or interactive media bots.

---

### Conclusion

The CNN API is an excellent tool for developers seeking to integrate real-time news content into their apps, websites, or services. With a simple, user-friendly design and extensive categories, it’s perfect for a wide range of use cases. Whether you're building a news app, newsletter, or chatbot, the CNN API helps keep your audience informed with the latest headlines and detailed reports from CNN's vast content library.

Be sure to explore its full potential by customizing requests based on categories and fetching detailed articles for a comprehensive news experience.

Documentação da API

Endpoints


get details news by URL



                                                                            
GET https://www.zylalabs.com/api/6437/cnn+api/9263/details+news
                                                                            
                                                                        

details news - Recursos do endpoint

Objeto Descrição
url [Obrigatório]
Testar endpoint

RESPOSTA DE EXEMPLO DA API

       
                                                                                                        
                                                                                                                                                                                                                                                                                                                                        {
    "url": "https:\/\/edition.cnn.com\/2024\/10\/23\/entertainment\/martha-stewart-golden-bachelorette\/index.html",
    "headline": "Martha Stewart has the funniest reason for not wanting to do \u00e2\u0080\u0098The Golden Bachelorette\u00e2\u0080\u0099 | CNN",
    "description": "Martha Stewart may be hot in the kitchen, but she\u00e2\u0080\u0099s not looking to replicate that on a dating reality show.",
    "image": "https:\/\/media.cnn.com\/api\/v1\/images\/stellar\/prod\/gettyimages-2178806460.jpg?c=16x9&q=w_800,c_fill",
    "author": "Lisa Respers France",
    "datePublished": "2024-10-23T13:19:27.261Z",
    "dateModified": "2024-10-23T13:19:27.261Z",
    "section": "2024",
    "site_name": "CNN",
    "locale": "en_US",
    "keywords": "",
    "tags": [
        ""
    ]
}
                                                                                                                                                                                                                    
                                                                                                    

Details news - TRECHOS DE CÓDIGO


curl --location --request GET 'https://zylalabs.com/api/6437/cnn+api/9263/details+news?url=https://edition.cnn.com/2024/10/23/entertainment/martha-stewart-golden-bachelorette/index.html' --header 'Authorization: Bearer YOUR_API_KEY' 


    

Get news by category URL



                                                                            
GET https://www.zylalabs.com/api/6437/cnn+api/9264/news+by+category
                                                                            
                                                                        

news by category - Recursos do endpoint

Objeto Descrição
url [Obrigatório]
Testar endpoint

RESPOSTA DE EXEMPLO DA API

       
                                                                                                        
                                                                                                                                                                                                                                                                                                                                        {
    "category": "top",
    "page": 1,
    "per_page": 10,
    "total_pages": 7,
    "total_items": 69,
    "items": [
        {
            "headline": "Some on-air claims about Dominion Voting Systems were false, Fox News acknowledges in statement after deal is announced",
            "description": "",
            "link": "https:\/\/www.cnn.com\/business\/live-news\/fox-news-dominion-trial-04-18-23\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/fox-news-dominion-trial-04-18-23-large-169.jpg",
            "pubDate": "Wed, 19 Apr 2023 12:44:51 GMT"
        },
        {
            "headline": "Dominion still has pending lawsuits against election deniers such as Rudy Giuliani and Sidney Powell",
            "description": "",
            "link": "https:\/\/www.cnn.com\/business\/live-news\/fox-news-dominion-trial-04-18-23\/h_8d51e3ae2714edaa0dace837305d03b8",
            "image": "",
            "pubDate": ""
        },
        {
            "headline": "Here are the 20 specific Fox broadcasts and tweets Dominion says were defamatory",
            "description": "\u2022 Fox-Dominion trial delay 'is not unusual,' judge says\n\u2022 Fox News' defamation battle isn't stopping Trump's election lies",
            "link": "https:\/\/www.cnn.com\/2023\/04\/17\/media\/dominion-fox-news-allegations\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/dominion-fox-news-allegations-large-169.jpg",
            "pubDate": "Mon, 17 Apr 2023 16:01:11 GMT"
        },
        {
            "headline": "Judge in Fox News-Dominion defamation trial: 'The parties have resolved their case'",
            "description": "The judge just announced in court that a settlement has been reached in the historic defamation case between Fox News and Dominion Voting Systems.",
            "link": "https:\/\/www.cnn.com\/2023\/04\/18\/media\/fox-dominion-settlement\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/fox-dominion-settlement-large-169.jpg",
            "pubDate": "Wed, 19 Apr 2023 08:28:17 GMT"
        },
        {
            "headline": "'Difficult to say with a straight face': Tapper reacts to Fox News' statement on settlement",
            "description": "A settlement has been reached in Dominion Voting Systems' defamation case against Fox News, the judge for the case announced. The network will pay more than $787 million to Dominion, a lawyer for the company said.",
            "link": "https:\/\/www.cnn.com\/videos\/politics\/2023\/04\/18\/jake-tapper-dominion-lawsuit-settlement-fox-news-statement-lead-vpx.cnn",
            "image": "",
            "pubDate": "Tue, 18 Apr 2023 21:17:44 GMT"
        },
        {
            "headline": "Millions in the US could face massive consequences unless McCarthy can navigate out of a debt trap he set for Biden",
            "description": "\u2022 DeSantis goes to Washington, a place he once despised, looking for support to take on Trump\n\u2022 Opinion: For the GOP to win, it must ditch Trump\n\u2022 Chris Christie mulling 2024 White House bid\n\u2022 Analysis: The fire next time has begun burning in Tennessee ",
            "link": "https:\/\/www.cnn.com\/2023\/04\/18\/politics\/mccarthy-biden-debt-ceiling\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/mccarthy-biden-debt-ceiling-large-169.jpg",
            "pubDate": "Tue, 18 Apr 2023 20:34:45 GMT"
        },
        {
            "headline": "White homeowner accused of shooting a Black teen who rang his doorbell turns himself in to face criminal charges",
            "description": "\u2022 'A major part of Ralph died': Aunt of teen shot after ringing wrong doorbell speaks\n\u2022 20-year-old woman shot after friend turned into the wrong driveway in upstate New York, officials say",
            "link": "https:\/\/www.cnn.com\/2023\/04\/18\/us\/kansas-city-ralph-yarl-shooting-tuesday\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/kansas-city-ralph-yarl-shooting-tuesday-large-169.jpg",
            "pubDate": "Wed, 19 Apr 2023 04:29:05 GMT"
        },
        {
            "headline": "Newly released video shows scene of Jeremy Renner's snowplow accident",
            "description": "Newly released body camera footage shows firefighters and sheriff's deputies rushing to help actor Jeremy Renner after a near-fatal snowplow accident in January. The \"Avengers\" actor broke more than 30 bones and suffered other severe injuries. CNN's Chloe Melas has more. ",
            "link": "https:\/\/www.cnn.com\/videos\/us\/2023\/04\/18\/jeremy-renner-snowplow-accident-bodycam-nc-melas-contd-vpx.cnn",
            "image": "",
            "pubDate": "Tue, 18 Apr 2023 14:09:43 GMT"
        },
        {
            "headline": "Jake Gyllenhaal and Jamie Lee Curtis spent the Covid-19 lockdown together",
            "description": "It's sourdough bread and handstands for Jake Gyllenhaal and Jamie Lee Curtis.",
            "link": "https:\/\/www.cnn.com\/2023\/04\/18\/entertainment\/jake-gyllenhaal-jamie-lee-curtis-pandemic-living\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/jake-gyllenhaal-jamie-lee-curtis-pandemic-living-large-169.jpg",
            "pubDate": "Tue, 18 Apr 2023 14:40:32 GMT"
        },
        {
            "headline": "Toddler crawls through White House fence, prompts Secret Service response",
            "description": "A tiny intruder infiltrated White House grounds Tuesday, prompting a swift response from the US Secret Service.",
            "link": "https:\/\/www.cnn.com\/2023\/04\/18\/politics\/white-house-toddler\/index.html",
            "image": "https:\/\/cdn.cnn.com\/cnnnext\/dam\/assets\/white-house-toddler-large-169.jpg",
            "pubDate": "Tue, 18 Apr 2023 17:38:16 GMT"
        }
    ],
    "available_categories": [
        "top",
        "world",
        "us",
        "politics",
        "business",
        "tech",
        "health",
        "entertainment",
        "travel",
        "sports",
        "opinion",
        "justice",
        "weather",
        "latest",
        "europe",
        "asia",
        "africa",
        "middleeast",
        "americas",
        "energy",
        "space",
        "food",
        "style",
        "living",
        "education"
    ]
}
                                                                                                                                                                                                                    
                                                                                                    

News by category - TRECHOS DE CÓDIGO


curl --location --request GET 'https://zylalabs.com/api/6437/cnn+api/9264/news+by+category?url=https://edition.cnn.com/entertainment' --header 'Authorization: Bearer YOUR_API_KEY' 


    

Chave de acesso à API e autenticação

Após se cadastrar, cada desenvolvedor recebe uma chave de acesso à API pessoal, uma combinação única de letras e dígitos para acessar nosso endpoint de API. Para autenticar com a CNN API basta incluir seu token Bearer no cabeçalho Authorization.
Cabeçalhos
Cabeçalho Descrição
Authorization [Obrigatório] Deve ser Bearer access_key. Veja "Sua chave de acesso à API" acima quando você estiver inscrito.

Preços simples e transparentes

Sem compromisso de longo prazo. Faça upgrade, downgrade ou cancele a qualquer momento. O teste gratuito inclui até 50 requisições.

🚀 Empresarial

A partir de
$ 10.000/Ano


  • Volume personalizado
  • Limite de taxa personalizado
  • Suporte ao cliente especializado
  • Monitoramento de API em tempo real

Recursos favoritos dos clientes

  • ✔︎ Pague apenas por requisições bem-sucedidas
  • ✔︎ Teste 7 dias gratis
  • ✔︎ Suporte multilíngue
  • ✔︎ Uma chave de API, todas as APIs.
  • ✔︎ Painel intuitivo
  • ✔︎ Tratamento de erros abrangente
  • ✔︎ Documentação amigável para desenvolvedores
  • ✔︎ Integração com Postman
  • ✔︎ Conexões HTTPS seguras
  • ✔︎ Alta disponibilidade

CNN API FAQs

The CNN API has two main endpoints. The "Get News by Category" endpoint returns a list of headlines and links for articles in specified categories. The "Get Detailed News Article" endpoint provides comprehensive details about a specific article, including the headline, description, images, videos, word count, and the full article body.

Key fields in the "Get News by Category" response include "headline" and "link." For the "Get Detailed News Article," important fields are "headline," "description," "thumbnailUrl," "articleBody," and "video links." These fields provide essential information for displaying news content.

The response data is structured in JSON format. For the category endpoint, it returns an array of articles under the "latest" key. The detailed article endpoint returns a single object with various keys representing different aspects of the article, such as "headline," "description," and "images."

The "Get News by Category" endpoint provides headlines and links to articles across various categories like U.S., World, Politics, and more. The "Get Detailed News Article" endpoint offers in-depth information about a specific article, including multimedia elements and a full text body.

The primary parameter for both endpoints is the "url" parameter, which specifies the CNN article or category URL you want to retrieve. Users can customize their requests by changing the URL to target different news categories or specific articles.

Users can display headlines and links from the category endpoint on news aggregation sites or apps. The detailed article data can be used to create rich content displays, including images and summaries, enhancing user engagement with multimedia elements.

Typical use cases include building news aggregation websites, developing mobile news apps, creating custom newsletters, and integrating with chatbots or smart assistants to provide users with real-time news updates tailored to their interests.

The CNN API sources its data directly from CNN, a reputable news organization. Data accuracy is maintained through regular updates and quality checks performed by CNN's editorial team, ensuring that the information provided is reliable and up-to-date.

Perguntas Frequentes Gerais

O Zyla API Hub é como uma grande loja de APIs, onde você pode encontrar milhares delas em um só lugar. Também oferecemos suporte dedicado e monitoramento em tempo real de todas as APIs. Após se cadastrar, você pode escolher quais APIs deseja usar. Lembre-se apenas de que cada API precisa de sua própria assinatura. Mas se você se inscrever em várias, usará a mesma chave para todas elas, facilitando as coisas para você.

Os preços são listados em USD (Dólar Americano), EUR (Euro), CAD (Dólar Canadense), AUD (Dólar Australiano) e GBP (Libra Esterlina). Aceitamos todos os principais cartões de débito e crédito. Nosso sistema de pagamento usa a mais recente tecnologia de segurança e é operado pela Stripe, uma das empresas de pagamento mais confiáveis do mundo. Se tiver problemas para pagar com cartão, entre em contato conosco em [email protected]


Além disso, se você já tiver uma assinatura ativa em qualquer uma dessas moedas (USD, EUR, CAD, AUD, GBP), essa moeda será mantida para assinaturas subsequentes. Você pode alterar a moeda a qualquer momento, desde que não tenha assinaturas ativas.

A moeda local exibida na página de preços é baseada no país do seu endereço IP e é fornecida apenas como referência. Os preços reais são em USD (Dólar Americano). Ao efetuar o pagamento, a cobrança aparecerá no extrato do seu cartão em USD, mesmo que você veja o valor equivalente em sua moeda local em nosso site. Isso significa que você não pode pagar diretamente com sua moeda local.

Ocasionalmente, o banco pode recusar a cobrança devido às configurações de proteção contra fraude. Sugerimos contatar seu banco inicialmente para verificar se estão bloqueando nossas cobranças. Você também pode acessar o Portal de Cobrança e alterar o cartão associado para realizar o pagamento. Se isso não funcionar e precisar de mais ajuda, entre em contato com nossa equipe em [email protected]

Os preços são determinados por uma assinatura recorrente mensal ou anual, dependendo do plano escolhido.

As chamadas de API são descontadas do seu plano com base nas requisições bem-sucedidas. Cada plano possui um número específico de chamadas por mês. Apenas chamadas bem-sucedidas, indicadas por uma resposta com Status 200, serão contabilizadas, garantindo que falhas não afetem sua cota mensal.

O Zyla API Hub funciona com um sistema de assinatura mensal recorrente. Seu ciclo de cobrança começa no dia em que você compra um dos planos pagos e será renovado no mesmo dia do mês seguinte. Portanto, cancele sua assinatura com antecedência se quiser evitar cobranças futuras.

Para fazer upgrade do seu plano atual, acesse a página de preços da API e selecione o novo plano desejado. O upgrade é instantâneo, permitindo aproveitar imediatamente os recursos do novo plano. Observe que as chamadas restantes do plano anterior não serão transferidas; você será cobrado pelo valor integral do novo plano.

Para verificar quantas chamadas de API restam para o mês atual, consulte o campo 'X-Zyla-API-Calls-Monthly-Remaining' no cabeçalho da resposta. Por exemplo, se seu plano permite 1.000 requisições por mês e você usou 100, este campo no cabeçalho da resposta indicará 900 chamadas restantes.

Para ver o número máximo de requisições de API que seu plano permite, verifique o cabeçalho de resposta 'X-Zyla-RateLimit-Limit'. Por exemplo, se seu plano inclui 1.000 requisições por mês, este cabeçalho exibirá 1.000.

O cabeçalho 'X-Zyla-RateLimit-Reset' mostra o número de segundos até seu limite de taxa ser redefinido. Isso informa quando sua contagem de requisições começará do zero. Por exemplo, se exibir 3.600, significa que restam 3.600 segundos até o limite ser redefinido.

Sim, você pode cancelar seu plano a qualquer momento acessando sua conta e selecionando a opção de cancelamento na página de Cobrança. Observe que upgrades, downgrades e cancelamentos têm efeito imediato. Além disso, após o cancelamento, você não terá mais acesso ao serviço, mesmo que ainda tenha chamadas restantes na sua cota.

Você pode nos contatar via chat para receber assistência imediata. Estamos online de 8h às 17h (EST). Se nos contatar após esse horário, retornaremos o mais rápido possível. Além disso, você pode enviar um e-mail para [email protected]

Para oferecer a oportunidade de experimentar nossas APIs sem compromisso, oferecemos um teste gratuito de 7 dias que permite realizar até 50 chamadas de API sem custo. Esse teste pode ser usado apenas uma vez; recomendamos aplicá-lo à API que mais interessa. Embora a maioria das APIs ofereça teste gratuito, algumas podem não oferecer. O teste termina após 7 dias ou quando você atingir 50 requisições, o que ocorrer primeiro. Se atingir o limite, será necessário "Iniciar seu plano pago" para continuar. Você encontra esse botão no perfil em Assinatura -> Escolha a API -> aba Preços. Se não cancelar até o 7º dia, sua assinatura será cobrada automaticamente, liberando todas as chamadas do plano.

Após 7 dias, será cobrado o valor total do plano ao qual você estava inscrito durante o teste. Portanto, é importante cancelar antes do término do período. Solicitações de reembolso por esquecimento de cancelamento não são aceitas.

Ao assinar um teste gratuito de API, você pode fazer até 50 chamadas. Se desejar fazer chamadas adicionais além desse limite, a API solicitará que você "Inicie seu plano pago". Você encontra o botão no perfil em Assinatura -> Escolha a API -> aba Preços.

As Ordens de Pagamento são processadas entre os dias 20 e 30 de cada mês. Se você enviar sua solicitação antes do dia 20, seu pagamento será processado dentro desse período.


APIs relacionadas


Você também pode gostar