New York Times

New York Times

News

Provides News. Multiple APIs have been built over our existing News API. You can make use of these APIs to receive latest news, go branding or explore COVID 19 info held with our networks.

Visit APIπŸ” Alternatives

πŸ“š Documentation & Examples

Everything you need to integrate with New York Times

πŸš€ Quick Start Examples

New York Times Javascript Examplejavascript
// New York Times API Example
const response = await fetch('https://developer.nytimes.com/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

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

Accessing the NY Times API with JavaScript

The NY Times provides a public API that allows developers to access a wealth of information from the newspaper. This guide will show you how to get started with using the NY Times API with JavaScript.

How to Get a New York Times API Key

The NYT APIs are free but require a key tied to a registered app:

  1. Sign up (or sign in) at https://developer.nytimes.com/.
  2. Under your account, open Apps and click + New App.
  3. Name the app, then enable the specific APIs you need (e.g. Top Stories, Article Search, Books) by toggling them on β€” this step is required, or requests return 401.
  4. Save, then copy the API Key shown on the app's page.

Rate limits: most APIs allow 500 requests per day and 5 requests per minute (the Archive API allows 2,000/day). Exceeding them returns HTTP 429.

Pass the key as the api-key query parameter:

const apiKey = 'YOUR_API_KEY';
const url = `https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${apiKey}`;

fetch(url)
  .then(res => res.json())
  .then(data => console.log(data.results));

When looping, pause about 12 seconds between calls to stay under the 5-per-minute limit.

API Endpoints

The NY Times API provides a range of different endpoints that allow access to different types of content. Some examples include:

  • Top Stories
  • Article Search
  • Books
  • Movie Reviews

Each endpoint requires a separate endpoint URL and set of parameters to query. You can find more information on each endpoint in the documentation from the NY Times API website.

Example Query

Here is an example query that retrieves the top stories from the NY Times in JavaScript.

const apiKey = 'YOUR_API_KEY';
const endpoint = 'https://api.nytimes.com/svc/topstories/v2/home.json';

fetch(`${endpoint}?api-key=${apiKey}`)
  .then(response => response.json())
  .then(data => {
    console.log(data.results);
  });

In this example, we are making use of the fetch function to retrieve the data from the API. We specify the API endpoint URL and our API key as parameters in the request. We then use the .then method to parse the JSON response and log the results to the console.

Conclusion

With the NY Times API, you can easily access a wealth of information from the newspaper to build your own applications. With endpoints for everything from top stories to book reviews, there is no shortage of data to work with. Use this guide to get started with using the NY Times API with JavaScript and start building your own apps today!

Explore More

Best New York Times alternatives (2026)Best News APIs

Related APIs in News