Currents

Currents

News

Currents - Capture the world news through simple json news API. Latest news published in various news sources, blogs and forums. 26 Million Entries and Counting, 18 Languages, News API sourced from over 70 countries, Data from Over 17,000 sources, 70,000 articles added daily and access to historical data.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Currents

🚀 Quick Start Examples

Currents Javascript Examplejavascript
// Currents API Example
const response = await fetch('https://currentsapi.services/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Introduction to Currents API

Currents API is a public API that allows users to fetch news articles from all around the world. It is a great tool for developers and researchers who want to stay up-to-date with the latest news in various industries.

The API provides various endpoints that users can use to fetch news articles based on different criteria. The endpoints include top headlines, search, latest news, and topic-based news.

This article will provide step-by-step instructions on how to use the Currents API, along with some sample codes in JavaScript.

Getting Started with Currents API

To get started with the Currents API, follow these steps:

  1. Go to https://currentsapi.services/ and sign up for a free account.

  2. Once logged in, you will be given an API key that you will use to authenticate your requests.

  3. Choose the endpoint you want to use and append it to the base URL https://api.currentsapi.services/v1/. For example, if you want to fetch the top headlines, the URL will be https://api.currentsapi.services/v1/latest-news?apiKey=YOUR_API_KEY.

  4. Make a request to the API using JavaScript's fetch method. This will return a promise that you can then parse and display the JSON data.

Here is an example code snippet that fetches the top headlines and displays them in the console:

const apiKey = "YOUR_API_KEY";
const url = `https://api.currentsapi.services/v1/latest-news?apiKey=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

This code snippet does the following:

  1. Sets the API key and the URL for the latest news endpoint.

  2. Makes a request to the API using the fetch method.

  3. Converts the response to a JSON object using the json() method.

  4. Logs the JSON data to the console.

Conclusion

Currents API is a powerful tool for developers and researchers who want to stay up-to-date with the latest news from around the world. Using JavaScript, it is easy to fetch and parse the data returned by the API. With the sample code above, you can start experimenting with the API and building your own news applications.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 7Jun 9Jun 11Jun 13Jun 15Jun 17Jun 19Jun 21Jun 23Jun 25Jun 27Jun 29Jul 1Jul 3Jul 604008001440Minutes
Online
Offline

Related APIs in News