Neste dia na história

Wikipedia "On This Day" as slim JSON

A OnThisDay API entrega os acontecimentos de uma data (nascimentos, mortes, eventos, feriados e destaques) a partir da Wikipedia, em JSON enxuto. Você escolhe a data, as seções, a ordem e exatamente quais campos quer receber.

The OnThisDay API serves a date's events (births, deaths, events, holidays and curated highlights) from Wikipedia as slim JSON. You pick the date, the sections, the order and exactly which fields to return.

Base: https://onthisday.api.insyde.one — aberta, sem autenticação / open, no auth.

Conteúdo da Wikipedia, licença CC BY-SA. O campo url de cada item aponta para o artigo de origem.
Content from Wikipedia, licensed CC BY-SA. Each item's url links back to the source article.

1. Endpoint

GET /?type=&month=&day=&fields=&limit=&order=&lang=

Sem nenhum parâmetro: hoje, todas as seções, campos padrão. / With no params: today, all sections, default fields.

# hoje, tudo / today, everything
curl "https://onthisday.api.insyde.one/"

# mortes em 3 de junho, só ano + texto, mais recentes primeiro
curl "https://onthisday.api.insyde.one/?type=deaths&month=6&day=3&fields=year,text&order=desc"

2. Parâmetros / Parameters

ParamPadrão / DefaultDescrição / Description
type all all ou CSV de selected,births,deaths,events,holidays. / all or a CSV of those sections.
month / day hoje / today 1–12 / 1–31. Parte omitida cai para hoje (UTC). / Missing part falls back to today (UTC).
fields year,text,title,extract,thumbnail,url CSV dos campos por item. full = todos + pages; adicione raw para o item bruto da Wikipedia. Desconhecidos são ignorados. / CSV of fields; full = all + pages; raw = untouched item.
limit 20 Itens por seção. Máx 100. 0 = sem limite. Aplicado depois da ordenação. / Items per section. Max 100. 0 = no cap. Applied after sorting.
order (nativa / native) asc / desc ordena cada seção por year. Itens sem ano (feriados) vão para o fim. / sorts each section by year; yearless items go last.
lang pt pt, en, es, de{lang}.wikipedia.org.

Seções: selected (destaques curados, ~3) · births · deaths · events · holidays (sem year).

3. Seletor de campos / Field selector

Cada item é normalizado num conjunto plano de campos. Sem fields, vem o conjunto padrão. Peça mais ou menos com fields=a,b,c, ou tudo com fields=full.

Each item is normalized to a flat set of fields. Without fields you get the default set. Ask for more or fewer with fields=a,b,c, or everything with fields=full.

Campos disponíveis / Available fields:

year · text · title · extract · extract_html · thumbnail · image
url · mobile_url · pageid · wikibase_item · coordinates · lang
displaytitle · description · pages (todas as páginas) · raw (item bruto)
// mínimo para IA / minimal for AI
curl "https://onthisday.api.insyde.one/?type=deaths&fields=year,text"

// tudo, incluindo o objeto bruto / everything, incl. raw upstream object
curl "https://onthisday.api.insyde.one/?type=selected&fields=full,raw&limit=1"

4. Formato da resposta / Response shape

// GET /?type=deaths&month=6&day=3&order=desc
{
  "date": "06-03",
  "lang": "pt",
  "type": "deaths",
  "deaths": [
    {
      "year": 1989,
      "text": "Ruhollah Khomeini, líder supremo do Irã (n. 1902).",
      "title": "Ruhollah Khomeini",
      "extract": "Sayyid Ruhollah Mostafavi Musavi Khomeini foi um aiatolá...",
      "thumbnail": "https://upload.wikimedia.org/.../330px-...jpg",
      "url": "https://pt.wikipedia.org/wiki/Ruhollah_Khomeini"
    }
  ]
}

Para type=all, a resposta traz um array por seção (selected, births, deaths, events, holidays). date, lang e type sempre presentes.
For type=all, the response carries one array per section. date, lang and type are always present.

5. Exemplos por linguagem / Examples by language

JavaScript (fetch):

const BASE = 'https://onthisday.api.insyde.one';

async function onThisDay(opts = {}) {
  const qs = new URLSearchParams(opts);
  const res = await fetch(`${BASE}/?${qs}`);
  if (!res.ok) throw new Error((await res.json()).error);
  return res.json();
}

const { deaths } = await onThisDay({ type: 'deaths', order: 'desc', fields: 'year,text', limit: 10 });

Python (requests):

import requests

resp = requests.get("https://onthisday.api.insyde.one/", params={
    "type": "births,deaths",
    "month": 6, "day": 3,
    "order": "desc",
    "fields": "year,text,title",
    "lang": "en",
})
resp.raise_for_status()
data = resp.json()

6. Uso como tool de IA / Use as an AI tool

A interface plana mapeia direto num schema de function calling. O seletor fields deixa o modelo pedir só o necessário, economizando tokens.

The flat interface maps directly to a function-calling schema. The fields selector lets the model request only what it needs, saving tokens.

{
  "name": "on_this_day",
  "description": "Historical events for a calendar date from Wikipedia.",
  "parameters": {
    "type": "object",
    "properties": {
      "type":   { "type": "string", "description": "all | selected | births | deaths | events | holidays (CSV ok)" },
      "month":  { "type": "integer", "minimum": 1, "maximum": 12 },
      "day":    { "type": "integer", "minimum": 1, "maximum": 31 },
      "fields": { "type": "string", "description": "CSV; default year,text,title,extract,thumbnail,url" },
      "order":  { "type": "string", "enum": ["asc", "desc"] },
      "limit":  { "type": "integer" },
      "lang":   { "type": "string", "enum": ["pt", "en", "es", "de"] }
    }
  }
}

7. Erros e cache / Errors & caching

Erros: { "error": "..." } com no-store. / Errors: { "error": "..." } with no-store.

HTTPQuando / When
400month/day, type ou lang inválido / invalid
404caminho desconhecido / unknown path
502falha ao buscar na Wikipedia / Wikipedia fetch failed
Cache: respostas 200 ficam 24h no CDN (1h no browser) — o dado de uma data é praticamente estático. /health e erros não são cacheados.
Caching: 200s are cached 24h at the CDN (1h in browsers) — a date's data is effectively static. /health and errors are never cached.

Back to Insyde APIs