Find an API

Search public APIs with auth details & Postman guides

← All APIs

Numbers API

numbersapi.com · Developer Tools

Developer Tools No Auth Free & Open Fun Math Trivia

Interesting facts about numbers — math trivia, year facts, date facts, and random number facts. No API key required.

Authentication

No authentication requiredFree to use with no key needed.

Sample Requests

GET Fact about a number

Get a trivia fact about the number 42.

https://numbersapi.com/42

Hover any highlighted part to learn what it does

curl -X GET "https://numbersapi.com/42"
import requests
response = requests.get(
    "https://numbersapi.com/42",
)
print(response.json())
const url = 'https://numbersapi.com/42';

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	targetURL := "https://numbersapi.com/42"
	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://numbersapi.com/42")

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://numbersapi.com/42";
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Math fact

Get a mathematical fact about 42.

https://numbersapi.com/42/math?json=

Hover any highlighted part to learn what it does

curl -X GET "https://numbersapi.com/42/math?json="
import requests
params = {
    "json": ""
}
response = requests.get(
    "https://numbersapi.com/42/math",
    params=params,
)
print(response.json())
const url = new URL('https://numbersapi.com/42/math');
url.searchParams.set('json', '');

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://numbersapi.com/42/math")
	q := baseURL.Query()
	q.Set("json", "")
	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://numbersapi.com/42/math")
uri.query = URI.encode_www_form({
  "json" => ""
})

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://numbersapi.com/42/math?" . http_build_query([
    "json" => ""
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Date fact

Get a fact about June 8th.

https://numbersapi.com/6/8/date?json=

Hover any highlighted part to learn what it does

curl -X GET "https://numbersapi.com/6/8/date?json="
import requests
params = {
    "json": ""
}
response = requests.get(
    "https://numbersapi.com/6/8/date",
    params=params,
)
print(response.json())
const url = new URL('https://numbersapi.com/6/8/date');
url.searchParams.set('json', '');

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://numbersapi.com/6/8/date")
	q := baseURL.Query()
	q.Set("json", "")
	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://numbersapi.com/6/8/date")
uri.query = URI.encode_www_form({
  "json" => ""
})

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://numbersapi.com/6/8/date?" . http_build_query([
    "json" => ""
]);
$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 Postman ↗
  1. No API key needed
  2. Trivia: GET https://numbersapi.com/42
  3. Math: GET https://numbersapi.com/1729/math
  4. Date: GET https://numbersapi.com/6/8/date (month/day)
  5. Year: GET https://numbersapi.com/1969/year
  6. Add ?json for JSON response instead of plain text

Open documentation ↗