Find an API

Search public APIs with auth details & Postman guides

← All APIs

New York Times API

api.nytimes.com · Media

Media API Key Free Tier News Media Journalism

Article search, top stories, most popular, books bestsellers, movie reviews, and more from The New York Times. Free API key required.

Authentication

API Key Free API key at developer.nytimes.com. Pass as ?api-key= query parameter.

Sample Requests

GET Search articles

Search NYT articles by keyword.

https://api.nytimes.com/svc/search/v2/articlesearch.json?q=technology&sort=newest&api-key=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://api.nytimes.com/svc/search/v2/articlesearch.json?q=technology&sort=newest&api-key=YOUR_KEY"
import requests
params = {
    "q": "technology",
    "sort": "newest",
    "api-key": "YOUR_KEY"
}
response = requests.get(
    "https://api.nytimes.com/svc/search/v2/articlesearch.json",
    params=params,
)
print(response.json())
const url = new URL('https://api.nytimes.com/svc/search/v2/articlesearch.json');
url.searchParams.set('q', 'technology');
url.searchParams.set('sort', 'newest');
url.searchParams.set('api-key', 'YOUR_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.nytimes.com/svc/search/v2/articlesearch.json")
	q := baseURL.Query()
	q.Set("q", "technology")
	q.Set("sort", "newest")
	q.Set("api-key", "YOUR_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.nytimes.com/svc/search/v2/articlesearch.json")
uri.query = URI.encode_www_form({
  "q" => "technology",
  "sort" => "newest",
  "api-key" => "YOUR_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.nytimes.com/svc/search/v2/articlesearch.json?" . http_build_query([
    "q" => "technology",
    "sort" => "newest",
    "api-key" => "YOUR_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Top stories

Get top technology stories.

https://api.nytimes.com/svc/topstories/v2/technology.json?api-key=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://api.nytimes.com/svc/topstories/v2/technology.json?api-key=YOUR_KEY"
import requests
params = {
    "api-key": "YOUR_KEY"
}
response = requests.get(
    "https://api.nytimes.com/svc/topstories/v2/technology.json",
    params=params,
)
print(response.json())
const url = new URL('https://api.nytimes.com/svc/topstories/v2/technology.json');
url.searchParams.set('api-key', 'YOUR_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.nytimes.com/svc/topstories/v2/technology.json")
	q := baseURL.Query()
	q.Set("api-key", "YOUR_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.nytimes.com/svc/topstories/v2/technology.json")
uri.query = URI.encode_www_form({
  "api-key" => "YOUR_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.nytimes.com/svc/topstories/v2/technology.json?" . http_build_query([
    "api-key" => "YOUR_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Register at developer.nytimes.com for a free API key
  2. Pass api-key=YOUR_KEY on every request
  3. Sections: home, arts, automobiles, books, business, fashion, food, health, insider, magazine, movies, nyregion, obituaries, opinion, politics, realestate, science, sports, sundayreview, technology, theater, t-magazine, travel, upshot, us, world

Open documentation ↗