Numbers API by David Hu and Mack Duan — a free, community-contributed HTTP API for interesting facts about numbers. Returns trivia, math, date, and year facts as plain text or JSON. Supports random numbers, ranges/batches, JSONP callbacks, document.write embedding, sentence-fragment responses, and configurable not-found behavior.
1 APIs12 Features
Science And MathPublic APIsTriviaNumbersDatesOpen Source
HTTP API for trivia, math, date, and year facts about numbers. URL pattern is `/{number}/{type}` where type is one of `trivia`, `math`, `date`, or `year`. Numbers may be integer...
Return a piece of trivia about a number, e.g. `42 is the number of little squares forming the left side trail of Microsoft's Windows 98 logo`.
Math Facts
Return a mathematical property of a number, e.g. `5 is the number of platonic solids`.
Date Facts
Return a fact about a day of the year (month/day), e.g. `February 29 is the day in 1504 that Christopher Columbus uses his knowledge of a lunar eclipse to convince Native Americans to provide him with supplies`.
Year Facts
Return a fact about a year, e.g. `1969 is the year that an estimated 500 million people worldwide watch Neil Armstrong take his historic first steps on the Moon`.
Random Numbers
Use the keyword `random` in place of a number to get a random fact, optionally bounded by `min` and `max` query parameters.
JSON Responses
Append `?json` (or send `Content-Type: application/json`) to receive the fact wrapped in an object with `text`, `found`, `number`, `type`, and optional `date`/`year` fields.
Sentence Fragment Mode
Append `?fragment` to get the fact rephrased as a lowercase, no- terminal-punctuation fragment suitable for embedding in a larger sentence.
Configurable Not Found Behavior
Use `notfound=default|floor|ceil` to control what happens when no fact exists for the requested number, with an optional custom `default=...` message.
JSONP Callback
Pass `callback=functionName` to wrap the response in a JSONP function call.
Document.write Embed
Pass `write` to wrap the response in `document.write(...)`, allowing a single `
aid: numbers
name: Numbers API
description: >-
Numbers API by David Hu and Mack Duan — a free, community-contributed HTTP API for interesting facts about numbers.
Returns trivia, math, date, and year facts as plain text or JSON. Supports random numbers, ranges/batches, JSONP
callbacks, document.write embedding, sentence-fragment responses, and configurable not-found behavior.
url: http://numbersapi.com/
specificationVersion: '0.20'
created: '2026-05-28'
modified: '2026-05-30'
x-source: public-apis/public-apis
x-category: Science & Math
x-tier: 3
x-tier-reason: opensource-community-api
tags:
- Science And Math
- Public APIs
- Trivia
- Numbers
- Dates
- Open Source
apis:
- name: Numbers API
description: >-
HTTP API for trivia, math, date, and year facts about numbers. URL pattern is `/{number}/{type}` where type is one
of `trivia`, `math`, `date`, or `year`. Numbers may be integers, the keyword `random`, a `month/day` date, or
batch ranges. Responses default to plain text and can be returned as JSON via the `json` query parameter.
humanURL: http://numbersapi.com/
baseURL: http://numbersapi.com/
tags:
- Science And Math
- Trivia
- Numbers
properties:
- type: Documentation
url: http://numbersapi.com/#api
- type: APIReference
url: http://numbersapi.com/#api
- type: GettingStarted
url: http://numbersapi.com/#api
- type: OpenAPI
url: openapi/numbers-openapi.yml
- type: JSONSchema
url: json-schema/numbers-fact-schema.json
- type: JSONSchema
url: json-schema/numbers-batch-facts-schema.json
- type: JSONStructure
url: json-structure/numbers-fact-structure.json
- type: JSONStructure
url: json-structure/numbers-batch-facts-structure.json
- type: Example
url: examples/numbers-fact-example.json
- type: Example
url: examples/numbers-trivia-fact-example.json
- type: Example
url: examples/numbers-math-fact-example.json
- type: Example
url: examples/numbers-date-fact-example.json
- type: Example
url: examples/numbers-year-fact-example.json
- type: Example
url: examples/numbers-batch-facts-example.json
common:
- type: Website
url: http://numbersapi.com/
- type: Documentation
url: http://numbersapi.com/#api
- type: Blog
url: http://david-hu.com/2012/03/05/announcing-numbers-api.html
- type: Contact
url: mailto:numbersapi@gmail.com
- type: PublicAPIsListing
url: https://github.com/public-apis/public-apis
- type: SpectralRules
url: rules/numbers-rules.yml
- type: Vocabulary
url: vocabulary/numbers-vocabulary.yml
- type: JSONLD
url: json-ld/numbers-context.jsonld
- type: Features
data:
- name: Trivia Facts
description: >-
Return a piece of trivia about a number, e.g. `42 is the number of little squares forming the left side trail
of Microsoft's Windows 98 logo`.
- name: Math Facts
description: Return a mathematical property of a number, e.g. `5 is the number of platonic solids`.
- name: Date Facts
description: >-
Return a fact about a day of the year (month/day), e.g. `February 29 is the day in 1504 that Christopher
Columbus uses his knowledge of a lunar eclipse to convince Native Americans to provide him with supplies`.
- name: Year Facts
description: >-
Return a fact about a year, e.g. `1969 is the year that an estimated 500 million people worldwide watch Neil
Armstrong take his historic first steps on the Moon`.
- name: Random Numbers
description: >-
Use the keyword `random` in place of a number to get a random fact, optionally bounded by `min` and `max`
query parameters.
- name: JSON Responses
description: >-
Append `?json` (or send `Content-Type: application/json`) to receive the fact wrapped in an object with
`text`, `found`, `number`, `type`, and optional `date`/`year` fields.
- name: Sentence Fragment Mode
description: >-
Append `?fragment` to get the fact rephrased as a lowercase, no- terminal-punctuation fragment suitable for
embedding in a larger sentence.
- name: Configurable Not Found Behavior
description: >-
Use `notfound=default|floor|ceil` to control what happens when no fact exists for the requested number, with
an optional custom `default=...` message.
- name: JSONP Callback
description: Pass `callback=functionName` to wrap the response in a JSONP function call.
- name: Document.write Embed
description: >-
Pass `write` to wrap the response in `document.write(...)`, allowing a single `<script src="...">` to render
the fact inline.
- name: Batch Requests
description: >-
Request facts for multiple numbers in one call using comma-separated values and `min..max` ranges (up to 100
numbers), returned as a JSON map.
- name: CORS Support
description: Supports cross-origin requests, allowing direct browser calls from any domain.
- type: UseCases
data:
- name: Engagement Copy
description: >-
Insert living facts into marketing copy or dashboards, e.g. `We now have more users than the number of times
Julius Caesar was stabbed`.
- name: Calendar Widgets
description: Pair `month/day/date` with a date picker or daily widget to surface a historical fact for the current day.
- name: Anniversary and Year-in-Review
description: Use `/{year}/year` to enrich anniversary, retrospective, and year-in-review content with curated facts.
- name: Daily Random Trivia
description: >-
Power "fact of the day" features for chatbots, newsletters, screen savers, and home assistants using
`/random/trivia`.
- name: Math Education
description: Surface mathematical properties of numbers in educational tools and worksheets via `/{n}/math`.
- name: Mock and Demo Data
description: >-
Provide free, unauthenticated, low-latency text responses ideal for tutorials, demos, and beginner HTTP client
exercises.
- type: Integrations
data:
- name: jQuery
description: The docs show a `$.get()` example loading a trivia fact directly into a DOM element.
- name: Browser JavaScript
description: Direct cross-origin requests via fetch/XHR are supported because the service emits permissive CORS headers.
- name: JSONP Consumers
description: The `callback` query parameter lets legacy JSONP clients consume facts as `functionName("...")` invocations.
- name: HTML script tag
description: >-
The `write` query parameter wraps responses in `document.write()`, so a single `<script
src="numbersapi.com/...">` tag can render a fact inline in static HTML.
- name: Public APIs Directory
description: Listed in public-apis/public-apis under the Science & Math category as a free, no-auth API.
maintainers:
- FN: Kin Lane
email: kin@apievangelist.com