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.
Usa esta API desde tu agente de IA vía MCP
Funciona con OpenClaw, Claude Code/Desktop, Cursor, Windsurf, Cline y cualquier cliente de IA compatible con MCP.
Docs y configuración
Crea un skill envolviendo 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.

Documentación de la API

Endpoints


get details news by URL



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

details news - Características del Endpoint

Objeto Descripción
url [Requerido]
Probar Endpoint

RESPUESTA DE EJEMPLO DE LA 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 - CÓDIGOS DE EJEMPLO


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://zylalabs.com/api/6437/cnn+api/9264/news+by+category
                                                                            
                                                                        

news by category - Características del Endpoint

Objeto Descripción
url [Requerido]
Probar Endpoint

RESPUESTA DE EJEMPLO DE LA 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 - CÓDIGOS DE EJEMPLO


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' 


    

Clave de Acceso a la API y Autenticación

Después de registrarte, a cada desarrollador se le asigna una clave de acceso a la API personal, una combinación única de letras y dígitos proporcionada para acceder a nuestro endpoint de la API. Para autenticarte con el CNN API simplemente incluye tu token de portador en el encabezado de Autorización.
Encabezados
Encabezado Descripción
Autorización [Requerido] Debería ser Bearer access_key. Consulta "Tu Clave de Acceso a la API" arriba cuando estés suscrito.

Precios Simples y Transparentes

Sin compromiso a largo plazo. Mejora, reduce o cancela en cualquier momento. La Prueba Gratuita incluye hasta 50 solicitudes.

🚀 PLAN CORPORATIVO A MEDIDA

Comienza en
$ 10.000/Año


  • Volumen Personalizado
  • Límite de solicitudes personalizado
  • Soporte al Cliente Especializado
  • Monitoreo de API en Tiempo Real

Funciones favoritas de los clientes

  • ✔︎ Paga Solo por Solicitudes Exitosas
  • ✔︎ Prueba 7 días gratis
  • ✔︎ Soporte Multilenguaje
  • ✔︎ Una Clave API, Todas las APIs.
  • ✔︎ Panel de Control Intuitivo
  • ✔︎ Manejo de Errores Integral
  • ✔︎ Documentación Amigable para Desarrolladores
  • ✔︎ Integración con Postman
  • ✔︎ Conexiones HTTPS Seguras
  • ✔︎ Tiempo de Actividad Fiable

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.

General FAQs

Zyla API Hub es como una gran tienda de APIs, donde puedes encontrar miles de ellas en un solo lugar. También ofrecemos soporte dedicado y monitoreo en tiempo real de todas las APIs. Una vez que te registres, puedes elegir qué APIs quieres usar. Solo recuerda que cada API necesita su propia suscripción. Pero si te suscribes a varias, usarás la misma clave para todas, lo que hace todo más fácil para ti.

Los precios se muestran en USD (dólar estadounidense), EUR (euro), CAD (dólar canadiense), AUD (dólar australiano) y GBP (libra esterlina). Aceptamos todas las principales tarjetas de débito y crédito. Nuestro sistema de pago utiliza la última tecnología de seguridad y está respaldado por Stripe, una de las compañías de pago más confiables del mundo. Si tienes algún problema para pagar con tarjeta, contáctanos en [email protected]


Además, si ya tienes una suscripción activa en cualquiera de estas monedas (USD, EUR, CAD, AUD, GBP), esa moneda se mantendrá para suscripciones posteriores. Puedes cambiar la moneda en cualquier momento siempre que no tengas suscripciones activas.

La moneda local que aparece en la página de precios se basa en el país de tu dirección IP y se proporciona solo como referencia. Los precios reales están en USD (dólar estadounidense). Cuando realices un pago, el cargo aparecerá en tu estado de cuenta en USD, incluso si ves el monto equivalente en tu moneda local en nuestro sitio web. Esto significa que no puedes pagar directamente en tu moneda local.

Ocasionalmente, un banco puede rechazar el cargo debido a sus configuraciones de protección contra fraude. Te sugerimos comunicarte con tu banco primero para verificar si están bloqueando nuestros cargos. También puedes acceder al Portal de Facturación y cambiar la tarjeta asociada para realizar el pago. Si esto no funciona y necesitas más ayuda, por favor contacta a nuestro equipo en [email protected]

Los precios se determinan mediante una suscripción recurrente mensual o anual, dependiendo del plan elegido.

Las llamadas a la API se descuentan de tu plan en base a solicitudes exitosas. Cada plan incluye una cantidad específica de llamadas que puedes realizar por mes. Solo las llamadas exitosas, indicadas por una respuesta con estado 200, se contarán en tu total. Esto asegura que las solicitudes fallidas o incompletas no afecten tu cuota mensual.

Zyla API Hub funciona con un sistema de suscripción mensual recurrente. Tu ciclo de facturación comenzará el día en que compres uno de los planes de pago, y se renovará el mismo día del mes siguiente. Así que recuerda cancelar tu suscripción antes si quieres evitar futuros cargos.

Para actualizar tu plan de suscripción actual, simplemente ve a la página de precios de la API y selecciona el plan al que deseas actualizarte. La actualización será instantánea, permitiéndote disfrutar inmediatamente de las funciones del nuevo plan. Ten en cuenta que las llamadas restantes de tu plan anterior no se transferirán al nuevo plan, por lo que debes considerar esto al actualizar. Se te cobrará el monto total del nuevo plan.

Para verificar cuántas llamadas a la API te quedan en el mes actual, revisa el campo 'X-Zyla-API-Calls-Monthly-Remaining' en el encabezado de la respuesta. Por ejemplo, si tu plan permite 1,000 solicitudes por mes y has usado 100, este campo mostrará 900 llamadas restantes.

Para ver el número máximo de solicitudes a la API que permite tu plan, revisa el encabezado de la respuesta 'X-Zyla-RateLimit-Limit'. Por ejemplo, si tu plan incluye 1,000 solicitudes por mes, este encabezado mostrará 1,000.

El encabezado 'X-Zyla-RateLimit-Reset' muestra el número de segundos hasta que tu límite se restablezca. Esto te indica cuándo tu conteo de solicitudes se reiniciará. Por ejemplo, si muestra 3,600, significa que faltan 3,600 segundos para que el límite se restablezca.

Sí, puedes cancelar tu plan en cualquier momento desde tu cuenta, seleccionando la opción de cancelación en la página de Facturación. Ten en cuenta que las actualizaciones, degradaciones y cancelaciones tienen efecto inmediato. Además, al cancelar ya no tendrás acceso al servicio, incluso si te quedaban llamadas en tu cuota.

Puedes contactarnos a través de nuestro canal de chat para recibir asistencia inmediata. Siempre estamos en línea de 8 a. m. a 5 p. m. (EST). Si nos contactas fuera de ese horario, te responderemos lo antes posible. Además, puedes escribirnos por correo electrónico a [email protected]

Para darte la oportunidad de probar nuestras APIs sin compromiso, ofrecemos una prueba gratuita de 7 días que te permite realizar hasta 50 llamadas a la API sin costo. Esta prueba solo se puede usar una vez, por lo que recomendamos aplicarla a la API que más te interese. Aunque la mayoría de nuestras APIs ofrecen prueba gratuita, algunas pueden no hacerlo. La prueba finaliza después de 7 días o cuando realices 50 solicitudes, lo que ocurra primero. Si alcanzas el límite de 50 solicitudes durante la prueba, deberás "Iniciar tu Plan de Pago" para continuar haciendo solicitudes. Puedes encontrar el botón "Iniciar tu Plan de Pago" en tu perfil bajo Suscripción -> Elige la API a la que estás suscrito -> Pestaña de Precios. Alternativamente, si no cancelas tu suscripción antes del día 7, tu prueba gratuita finalizará y tu plan se cobrará automáticamente, otorgándote acceso a todas las llamadas a la API especificadas en tu plan. Ten esto en cuenta para evitar cargos no deseados.

Después de 7 días, se te cobrará el monto total del plan al que estabas suscrito durante la prueba. Por lo tanto, es importante cancelar antes de que finalice el periodo de prueba. No se aceptan solicitudes de reembolso por olvidar cancelar a tiempo.

Cuando te suscribes a una prueba gratuita de una API, puedes realizar hasta 50 llamadas. Si deseas realizar más llamadas después de este límite, la API te pedirá que "Inicies tu Plan de Pago". Puedes encontrar el botón "Iniciar tu Plan de Pago" en tu perfil bajo Suscripción -> Elige la API a la que estás suscrito -> Pestaña de Precios.

Las Órdenes de Pago se procesan entre el día 20 y el 30 de cada mes. Si envías tu solicitud antes del día 20, tu pago será procesado dentro de ese período.

 Nivel de Servicio
100%
 Tiempo de Respuesta
7.429ms

Categoría:


APIs Relacionadas


También te puede interesar