Events, Births and Deads
https://historyapi.dev/api/v1
Requests do not currently require any Authorization
header
All responses are returned in
JSON-LD format (application/ld+json
).
It can be consumed like regular JSON, but also includes semantic metadata
(e.g., @context
, @id
, @type
) for
linked data support.
Collection endpoints support pagination with the following parameters:
page
: Page number (default: 1)itemsPerPage
: Items per page (default: 20, maximum: 100)If you prefer, you can view the Swagger documentation.
Retrieves a collection of historical events
Parameter | Type | Required | Description |
---|---|---|---|
year |
integer | Optional | Event year (exact match) |
month |
integer | Optional | Event month (1-12, exact match) |
day |
integer | Optional | Event day (1-31, exact match) |
type |
string | Optional | Event type: event , birth , death |
lang |
string | Optional | Event language: en |
text |
string | Optional | Partial search in event text |
page |
integer | Optional | Page number (default: 1) |
itemsPerPage |
integer | Optional | Items per page (default: 20, maximum: 100) |
GET https://historyapi.dev/api/v1/events?lang=en
{
"@context": "/v1/contexts/Event",
"@id": "/v1/events",
"@type": "hydra:Collection",
"hydra:totalItems": 138366,
"hydra:member": [
{
"@id": "/v1/events/1",
"@type": "Event",
"id": 12812,
"year": 1969,
"month": 7,
"day": 20,
"text": "Apollo 11 lands on the Moon",
"type": "event",
"lang": "en",
"active": true,
}
{...}
],
"hydra:view": {
"@id": "/v1/events?page=2",
"@type": "hydra:PartialCollectionView"
"first": "/api/v1/events?page=1",
"last": "/api/v1/events?page=6918",
"previous": "/api/v1/events?page=1",
"next": "/api/v1/events?page=3"
}
}
Creates a new historical event
Field | Type | Required | Description |
---|---|---|---|
year |
integer | Required | Event year |
month |
integer | Required | Event month (1-12) |
day |
integer | Required | Event day (1-31) |
text |
string (text) | Required | Event description |
type |
string | Required | Type: event , birth or death |
lang |
string | Required | Language: en |
{
"year": 1969,
"month": 7,
"day": 20,
"text": "Apollo 11 lands on the Moon",
"type": "event",
"lang": "en"
}
{
"@context": "/v1/contexts/Event",
"@id": "/v1/events/1",
"@type": "Event",
"id": 1,
"year": 1969,
"month": 7,
"day": 20,
"text": "Apollo 11 lands on the Moon",
"type": "event",
"lang": "en",
"active": false
}
active: false
by default
and require administrative approval.
Creates a report about an event
Field | Type | Required | Description |
---|---|---|---|
targetId |
integer | Required | ID of the event to report |
reason |
string (max: 255) | Required | Reason for the report |
text |
string (max: 255) | Required | Detailed description of the issue |
email |
string (max: 255) | Required | Reporter's contact email |
{
"targetId": 123,
"reason": "Incorrect information",
"text": "The date of this event is wrong. It should be July 21, not July 20.",
"email": "user@example.com"
}
{
"@context": "/v1/contexts/Report",
"@id": "/v1/reports/1",
"@type": "Report",
"id": 1
}
Allows searching by specific fields with different strategies:
Field | Strategy | Description | Example |
---|---|---|---|
year |
exact | Exact match | ?year=1969 |
month |
exact | Exact match | ?month=7 |
day |
exact | Exact match | ?day=20 |
type |
exact | Exact match | ?type=event |
lang |
exact | Exact match | ?lang=en |
text |
partial | Partial search (LIKE %text%) | ?text=Apollo |
Allows filtering by numeric ranges using operators:
Operator | Description | Example |
---|---|---|
[gt] |
Greater than | ?year[gt]=1900 |
[gte] |
Greater than or equal | ?year[gte]=1900 |
[lt] |
Less than | ?year[lt]=2000 |
[lte] |
Less than or equal | ?year[lte]=2000 |
[between] |
Between two values | ?year[between]=1900..2000 |
# Events after 1950
GET /v1/events?year[gt]=1950
# Events between 1900 and 2000
GET /v1/events?year[between]=1900..2000
# Events from the 20th century
GET /v1/events?year[gte]=1900&year[lt]=2000
You can combine multiple filters in a single request:
# Births in July between 1940 and 1960
GET /v1/events?type=birth&month=7&year[between]=1940..1960
# Events containing "moon" in text from the 20th century
GET /v1/events?text=moon&year[gte]=1900&year[lt]=2000
# Deaths in 1969
GET /v1/events?type=death&year=1969
The API implements rate limiting using the Token Bucket strategy to prevent abuse:
429
Too Many Requests
response. Limits reset automatically according to the
specified intervals.
The API has CORS configured to allow requests from any domain:
Configuration | Value |
---|---|
Allowed Origins | All domains (*) |
Allowed Methods | GET , OPTIONS , POST |
Allowed Headers | Content-Type , Authorization |
Exposed Headers | Link |
Max Age | 3600 seconds (1 hour) |
Code | Description |
---|---|
200 | OK - Successful request |
201 | Created - Resource successfully created |
400 | Bad Request - Request error (invalid parameters) |
404 | Not Found - Resource not found |
422 | Unprocessable Entity - Validation error |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server error |