{
	"openapi": "3.1.0",
	"info": {
		"title": "JournoFinder News API",
		"version": "1.0.0",
		"description": "Search the news that JournoFinder tracks, and see what is trending right now.\n\nUse it to find stories about your topics that you or your clients could comment on. Every story is grouped: copies of the same headline from different outlets are counted once, with the outlets listed.\n\n## Get a key\n\n1. Log in at [app.journofinder.com](https://app.journofinder.com) (a free account works).\n2. Go to **Preferences → API** and click **Create API key**.\n3. Copy the key. It starts with `jf_live_`. You can see it again on the same page.\n\nSend it on every request, in the URL or in a header:\n\n```\nhttps://api.journofinder.com/v1/news/stories?q=heat+pumps&key=jf_live_...\n```\n\n```\nAuthorization: Bearer jf_live_...\n```\n\nThe URL form works when you paste it into a browser, and when you give it to an AI agent to fetch. Anyone who sees the URL can use your key. If a URL with your key gets out, click **Replace key**.\n\n## Limits\n\n| Endpoint | Limit |\n| --- | --- |\n| `/v1/news/stories` | 1,000 calls a month (resets on the 1st, UTC) and 30 an hour |\n| `/v1/news/trending` | 1,000 calls a month (resets on the 1st, UTC) and 60 an hour |\n\nEvery response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds). When you go over, you get a `429` with a `Retry-After` header in seconds.\n\nChecking one topic every hour uses 720 searches a month.\n\n## Links\n\nEach headline has a `url` on journofinder.com that opens the original article.\n\n## Errors\n\nErrors always look like this:\n\n```json\n{ \"error\": { \"code\": \"invalid_request\", \"message\": \"hours must be a whole number from 1 to 72. API spec: https://api.journofinder.com/openapi.json\" } }\n```\n\n| Status | code | When |\n| --- | --- | --- |\n| 400 | `invalid_request` | A parameter is missing or out of range. Values are never silently changed. |\n| 401 | `unauthorized` | The key is missing or wrong. |\n| 404 | `not_found` | No endpoint at that path. |\n| 405 | `method_not_allowed` | Only GET is supported. |\n| 429 | `rate_limited` | Over the limit. Wait `Retry-After` seconds. |\n| 500 | `server_error` | Something went wrong on our side. |\n| 503 | `unavailable` | We could not check your key, or search is down for a moment. Try again shortly. |\n\nA deleted or replaced key can keep working for up to 5 minutes.",
		"contact": {
			"name": "JournoFinder",
			"url": "https://journofinder.com"
		}
	},
	"servers": [
		{
			"url": "https://api.journofinder.com"
		}
	],
	"security": [
		{
			"apiKey": []
		},
		{
			"keyParam": []
		}
	],
	"tags": [
		{
			"name": "News",
			"description": "Stories from the news JournoFinder tracks."
		}
	],
	"paths": {
		"/v1/news/stories": {
			"get": {
				"tags": [
					"News"
				],
				"operationId": "searchStories",
				"summary": "Search stories",
				"description": "Find recent stories about a topic. Write the topic in plain words, like you would type it into a search box. There is no special query syntax.\n\nResults are filtered so only news stories about the topic come back. Job ads, shop pages, recipes and other pages that only share a word with the topic are removed. This means you can get fewer stories than `limit`, or none.",
				"parameters": [
					{
						"name": "q",
						"in": "query",
						"required": true,
						"description": "The topic, in plain words. Up to 200 characters.",
						"schema": {
							"type": "string",
							"minLength": 1,
							"maxLength": 200
						},
						"example": "heat pumps"
					},
					{
						"name": "hours",
						"in": "query",
						"description": "How far back to look, in hours.",
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 72,
							"default": 48
						}
					},
					{
						"name": "limit",
						"in": "query",
						"description": "The most stories to return.",
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 25,
							"default": 10
						}
					},
					{
						"name": "sort",
						"in": "query",
						"description": "`coverage`: stories covered by the most outlets first. `relevance`: stories closest to your topic first.",
						"schema": {
							"type": "string",
							"enum": [
								"coverage",
								"relevance"
							],
							"default": "coverage"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Matching stories.",
						"headers": {
							"X-RateLimit-Limit": {
								"$ref": "#/components/headers/RateLimitLimit"
							},
							"X-RateLimit-Remaining": {
								"$ref": "#/components/headers/RateLimitRemaining"
							},
							"X-RateLimit-Reset": {
								"$ref": "#/components/headers/RateLimitReset"
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/StoriesResponse"
								},
								"example": {
									"query": "heat pumps",
									"hours": 48,
									"sort": "coverage",
									"count": 1,
									"stories": [
										{
											"id": "be5e82e8fd7eba9f...",
											"headline": "Heat pump sales soar across Europe after states cut electricity taxes, data shows",
											"articles": 2,
											"outlets": 3,
											"firstSeen": "2026-09-27T08:12:00.000Z",
											"lastSeen": "2026-09-27T15:40:10.000Z",
											"headlines": [
												{
													"title": "Heat pump sales soar across Europe after states cut electricity taxes, data shows",
													"outlet": "Reuters",
													"publishedAt": "2026-09-27T08:12:00.000Z",
													"url": "https://journofinder.com/news-graph/1v_oGSL3vMrO..."
												}
											]
										}
									]
								}
							}
						}
					},
					"400": {
						"$ref": "#/components/responses/BadRequest"
					},
					"401": {
						"$ref": "#/components/responses/Unauthorized"
					},
					"429": {
						"$ref": "#/components/responses/RateLimited"
					}
				}
			}
		},
		"/v1/news/trending": {
			"get": {
				"tags": [
					"News"
				],
				"operationId": "trendingStories",
				"summary": "Trending stories",
				"description": "The stories getting the most new coverage right now, from the last 24 hours. Updated every hour. The same list as [journofinder.com/trending-stories](https://journofinder.com/trending-stories).\n\nStory `id`s here change every hour, so don't store them to compare between calls. Compare headlines instead.",
				"parameters": [
					{
						"name": "sort",
						"in": "query",
						"description": "`growth`: fastest rising first. `size`: most articles first.",
						"schema": {
							"type": "string",
							"enum": [
								"growth",
								"size"
							],
							"default": "growth"
						}
					},
					{
						"name": "category",
						"in": "query",
						"description": "Only return stories in this category.",
						"schema": {
							"$ref": "#/components/schemas/Category"
						}
					},
					{
						"name": "limit",
						"in": "query",
						"description": "The most stories to return.",
						"schema": {
							"type": "integer",
							"minimum": 1,
							"maximum": 100,
							"default": 20
						}
					}
				],
				"responses": {
					"200": {
						"description": "Trending stories.",
						"headers": {
							"X-RateLimit-Limit": {
								"$ref": "#/components/headers/RateLimitLimit"
							},
							"X-RateLimit-Remaining": {
								"$ref": "#/components/headers/RateLimitRemaining"
							},
							"X-RateLimit-Reset": {
								"$ref": "#/components/headers/RateLimitReset"
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TrendingResponse"
								},
								"example": {
									"sort": "growth",
									"category": null,
									"count": 1,
									"generatedAt": "2026-09-28T14:51:25.740Z",
									"stories": [
										{
											"id": "568495f8d6d1",
											"headline": "Nvidia authorizes $150 billion share buyback",
											"category": "business",
											"articles": 75,
											"outlets": 44,
											"growth": 36.35,
											"firstSeen": "2026-09-28T11:10:50.000Z",
											"lastSeen": "2026-09-28T14:26:46.000Z",
											"hourlyArticles": [
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												0,
												36,
												27,
												12,
												5
											]
										}
									]
								}
							}
						}
					},
					"400": {
						"$ref": "#/components/responses/BadRequest"
					},
					"401": {
						"$ref": "#/components/responses/Unauthorized"
					},
					"429": {
						"$ref": "#/components/responses/RateLimited"
					}
				}
			}
		}
	},
	"components": {
		"securitySchemes": {
			"apiKey": {
				"type": "http",
				"scheme": "bearer",
				"description": "Your key from app.journofinder.com → Preferences → API. Starts with `jf_live_`. Send it as `Authorization: Bearer jf_live_...`."
			},
			"keyParam": {
				"type": "apiKey",
				"in": "query",
				"name": "key",
				"description": "The same key in the URL, for example `?key=jf_live_...`. Lets you open a call in a browser or give a plain URL to an AI agent. Anyone who sees the URL can use your key, so replace the key if a URL gets out."
			}
		},
		"schemas": {
			"Category": {
				"type": "string",
				"enum": [
					"world-conflict",
					"politics",
					"business",
					"tech-science",
					"health",
					"environment",
					"sports",
					"entertainment",
					"crime-justice",
					"disaster-weather",
					"local-community",
					"lifestyle",
					"other"
				]
			},
			"Headline": {
				"type": "object",
				"required": [
					"title",
					"outlet",
					"publishedAt",
					"url"
				],
				"properties": {
					"title": {
						"type": "string"
					},
					"outlet": {
						"type": "string",
						"description": "The outlet's name."
					},
					"publishedAt": {
						"type": "string",
						"format": "date-time"
					},
					"url": {
						"type": "string",
						"format": "uri",
						"description": "A journofinder.com link that opens the original article."
					}
				}
			},
			"Story": {
				"type": "object",
				"required": [
					"id",
					"headline",
					"articles",
					"outlets",
					"firstSeen",
					"lastSeen",
					"headlines"
				],
				"properties": {
					"id": {
						"type": "string",
						"description": "Stays the same between calls, so you can use it to skip stories you have already seen."
					},
					"headline": {
						"type": "string",
						"description": "The best-matching headline."
					},
					"articles": {
						"type": "integer",
						"description": "Different headlines in the story."
					},
					"outlets": {
						"type": "integer",
						"description": "Outlets that ran the story, including copies of the same headline."
					},
					"firstSeen": {
						"type": "string",
						"format": "date-time"
					},
					"lastSeen": {
						"type": "string",
						"format": "date-time"
					},
					"headlines": {
						"type": "array",
						"maxItems": 5,
						"description": "Up to 5 headlines from the story, best match first.",
						"items": {
							"$ref": "#/components/schemas/Headline"
						}
					}
				}
			},
			"StoriesResponse": {
				"type": "object",
				"required": [
					"query",
					"hours",
					"sort",
					"count",
					"stories"
				],
				"properties": {
					"query": {
						"type": "string"
					},
					"hours": {
						"type": "integer"
					},
					"sort": {
						"type": "string",
						"enum": [
							"coverage",
							"relevance"
						]
					},
					"count": {
						"type": "integer"
					},
					"stories": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Story"
						}
					}
				}
			},
			"TrendingStory": {
				"type": "object",
				"required": [
					"id",
					"headline",
					"category",
					"articles",
					"outlets",
					"growth",
					"firstSeen",
					"lastSeen",
					"hourlyArticles"
				],
				"properties": {
					"id": {
						"type": "string",
						"description": "Changes every hour."
					},
					"headline": {
						"type": "string"
					},
					"category": {
						"$ref": "#/components/schemas/Category"
					},
					"articles": {
						"type": "integer"
					},
					"outlets": {
						"type": "integer"
					},
					"growth": {
						"type": "number",
						"description": "How fast coverage is rising. Higher is faster. Use it to compare stories, not as a count."
					},
					"firstSeen": {
						"type": "string",
						"format": "date-time"
					},
					"lastSeen": {
						"type": "string",
						"format": "date-time"
					},
					"hourlyArticles": {
						"type": "array",
						"items": {
							"type": "integer"
						},
						"description": "New articles per hour over the last 24 hours, oldest first."
					}
				}
			},
			"TrendingResponse": {
				"type": "object",
				"required": [
					"sort",
					"category",
					"count",
					"generatedAt",
					"stories"
				],
				"properties": {
					"sort": {
						"type": "string",
						"enum": [
							"growth",
							"size"
						]
					},
					"category": {
						"oneOf": [
							{
								"$ref": "#/components/schemas/Category"
							},
							{
								"type": "null"
							}
						]
					},
					"count": {
						"type": "integer"
					},
					"generatedAt": {
						"type": "string",
						"format": "date-time",
						"description": "When the trending list was last updated."
					},
					"stories": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TrendingStory"
						}
					}
				}
			},
			"Error": {
				"type": "object",
				"required": [
					"error"
				],
				"properties": {
					"error": {
						"type": "object",
						"required": [
							"code",
							"message"
						],
						"properties": {
							"code": {
								"type": "string"
							},
							"message": {
								"type": "string"
							}
						}
					}
				}
			}
		},
		"responses": {
			"BadRequest": {
				"description": "A parameter is missing or out of range.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/Error"
						},
						"example": {
							"error": {
								"code": "invalid_request",
								"message": "q is required, for example q=heat pumps"
							}
						}
					}
				}
			},
			"Unauthorized": {
				"description": "The API key is missing or wrong.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/Error"
						},
						"example": {
							"error": {
								"code": "unauthorized",
								"message": "Missing or invalid API key. Send the header Authorization: Bearer jf_live_... Create a free key at https://app.journofinder.com/preferences/api"
							}
						}
					}
				}
			},
			"RateLimited": {
				"description": "Over the limit.",
				"headers": {
					"Retry-After": {
						"description": "Seconds to wait.",
						"schema": {
							"type": "integer"
						}
					}
				},
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/Error"
						},
						"example": {
							"error": {
								"code": "rate_limited",
								"message": "Rate limit reached (30 per hour). Try again in 1200 seconds."
							}
						}
					}
				}
			}
		},
		"headers": {
			"RateLimitLimit": {
				"description": "Calls allowed in the current window.",
				"schema": {
					"type": "integer"
				}
			},
			"RateLimitRemaining": {
				"description": "Calls left in the current window.",
				"schema": {
					"type": "integer"
				}
			},
			"RateLimitReset": {
				"description": "When the window resets, in Unix seconds.",
				"schema": {
					"type": "integer"
				}
			}
		}
	}
}
