The Guardian API
content.guardianapis.com · Media
Access all Guardian content since 1999 — 2.4M+ articles, galleries, videos, and podcasts. Filter by section, contributor, keyword, and date. Free tier: 500 requests/day.
Authentication
API Key
Free API key at open-platform.theguardian.com. Pass as ?api-key= query parameter.
Sample Requests
GET
Search articles
Search Guardian articles by keyword.
https://content.guardianapis.com/search?q=climate change&api-key=YOUR_KEY&page-size=5&show-fields=headline,byline,thumbnail
Hover any highlighted part to learn what it does
curl -X GET "https://content.guardianapis.com/search?q=climate%20change&api-key=YOUR_KEY&page-size=5&show-fields=headline%2Cbyline%2Cthumbnail"
import requests
params = {
"q": "climate change",
"api-key": "YOUR_KEY",
"page-size": "5",
"show-fields": "headline,byline,thumbnail"
}
response = requests.get(
"https://content.guardianapis.com/search",
params=params,
)
print(response.json())const url = new URL('https://content.guardianapis.com/search');
url.searchParams.set('q', 'climate change');
url.searchParams.set('api-key', 'YOUR_KEY');
url.searchParams.set('page-size', '5');
url.searchParams.set('show-fields', 'headline,byline,thumbnail');
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://content.guardianapis.com/search")
q := baseURL.Query()
q.Set("q", "climate change")
q.Set("api-key", "YOUR_KEY")
q.Set("page-size", "5")
q.Set("show-fields", "headline,byline,thumbnail")
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://content.guardianapis.com/search")
uri.query = URI.encode_www_form({
"q" => "climate change",
"api-key" => "YOUR_KEY",
"page-size" => "5",
"show-fields" => "headline,byline,thumbnail"
})
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://content.guardianapis.com/search?" . http_build_query([
"q" => "climate change",
"api-key" => "YOUR_KEY",
"page-size" => "5",
"show-fields" => "headline,byline,thumbnail"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get a section
Get the latest technology articles.
https://content.guardianapis.com/technology?api-key=YOUR_KEY&page-size=5
Hover any highlighted part to learn what it does
curl -X GET "https://content.guardianapis.com/technology?api-key=YOUR_KEY&page-size=5"
import requests
params = {
"api-key": "YOUR_KEY",
"page-size": "5"
}
response = requests.get(
"https://content.guardianapis.com/technology",
params=params,
)
print(response.json())const url = new URL('https://content.guardianapis.com/technology');
url.searchParams.set('api-key', 'YOUR_KEY');
url.searchParams.set('page-size', '5');
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://content.guardianapis.com/technology")
q := baseURL.Query()
q.Set("api-key", "YOUR_KEY")
q.Set("page-size", "5")
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://content.guardianapis.com/technology")
uri.query = URI.encode_www_form({
"api-key" => "YOUR_KEY",
"page-size" => "5"
})
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://content.guardianapis.com/technology?" . http_build_query([
"api-key" => "YOUR_KEY",
"page-size" => "5"
]);
$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 a free API key at open-platform.theguardian.com
- Pass api-key=YOUR_KEY on every request
- Try GET https://content.guardianapis.com/search?q=AI&api-key=YOUR_KEY&page-size=5
- Add show-fields=headline,byline,thumbnail,body for richer responses