Facts API

Facts API gives you API access to facts generator, so that you can integrate this functionality in your websites or applications.

To access the web version of this functionality click here.

API End Points

The end point for connecting : If you subscribe directly from us use this endpoint.
	https://api.fungenerators.com
	

Ratelimiting

Some of our API calls are public. To maintain our service level we ratelimit the number of API calls. For public API calls this is 60 API calls a day with distribution of 5 calls an hour. For paid plans this limit is increased according to the service level described in the plan.

Authentication

For public calls you don't need to pass any API key. Just invoke the endpoint (see examples below). For paid subscriptions you need to pass the API key.

Currently we support API Key based authentication. Please set a request header 'X-FunGenerators-Api-Secret' with value of your API key. Alternatively you can also pass api_key= as a request parameter, though we strongly discourage this mode of passing the key.

API Documentation

Get a Random Fact

GET /fact/random
If you are using curl the request will look something like this. The parameters categroy and subcategory are optional.
curl -X GET "http://api.fungenerators.com/fact/random?category=Countries&subcategory=USA" -H  "accept: application/json" -H  "X-Fungenerators-Api-Secret: api_key"
{
  "success": {
    "total": 1
  },
  "contents": {
    "fact": "The most iconic donut shop in Hollywood is Randy's Donuts. It has appeared in many movies including Crocodile Dundee and Iron Man 2.",
    "id": "VbUC4jKvaxzHNgs2FRUthweF",
    "category": "Food ",
    "subcategory": "Donuts "
  }
}

Search for a random Fact

GET /fact/search
If you are using curl the request will look something like this. The parameter 'query' is mandatory while the parameters categroy and subcategory are optional.
curl -X GET "http://api.fungenerators.com/fact/search?query=Amazon" -H  "accept: application/json" -H  "X-Fungenerators-Api-Secret: api_key"
The response will have the structure like below.
{
  "success":{"total":1},
  "contents":{
    "fact":"There are more than 1,100 known tributaries flowing into the Amazon River. Tributaries are sources of water such as a small river, stream  or other water flow that reaches the river.",
    "id":"LCN5KlSn6BMpcm3ruXhfGweF",
    "category": "Rivers",
    "subcategory": "Amazon River"
    
  }
  
}

Create a Fact Enry

Use put on /fact end point to create a new fact entry. This will be your in your private collection and you can retrieve it later.
PUT /fact
curl -X PUT "http://api.fungenerators.com/fact?fact=January%2020th%20is%20the%20day%20in%201941%20that%20a%20Nazi%20officer%20is%20murdered%20in%20Bucharest%2C%20Romania%2C%20sparking%20a%20rebellion%20and%20pogrom%20by%20the%20Iron%20Guard%2C%20killing%20125%20Jews%20and%2030%20soldiers.&category=Numbers&subcategory=Date&tags=numbers%2C%20historical" -H  "accept: application/json" -H  "X-Fungenerators-Api-Secret: api_key"
Upon success the id of the newly created fact is returned in the response.
{
    "success": {
        "total": 1
    },
    "contents": {
        "id": "62D6iKM9GSlJxK5nrMf9XwrE"
    }
}

Get a Fact entry

GET /fact
curl -X GET "http://api.fungenerators.com/fact?id=LCN5KlSn6BMpcm3ruXhfGweF" -H  "accept: application/json" -H  "X-Fungenerators-Api-Secret: api_key"
If there is a fact entry with the id in the system, it will be returned in the response.
{
  "success":{"total":1},
  "contents":{
    "fact":"There are more than 1,100 known tributaries flowing into the Amazon River. Tributaries are sources of water such as a small river, stream  or other water flow that reaches the river.",
    "id":"LCN5KlSn6BMpcm3ruXhfGweF",
    "category": "Rivers",
    "subcategory": "Amazon River"
    
  }
  
}

Delete a Fact

DELETE /fact

In curl this request will look something like this

curl -X DELETE "http://api.fungenerators.com/fact?id=uHBbOfP7ECfVkeQrE" -H  "accept: application/json" -H  "X-Fungenerators-Api-Secret: api_key"
{
    "success": {
        "total": 1
    },
    "contents": {
        "mesg": "Fact uHBbOfP7ECfVkeQrE is deleted"
    }
}

API Console

The following are the API calls you can make. You can try out / test the calls right from this page. Please note, javascript needs to be enabled to see the documentation below.

Subscribe

Fun Generators Facts API Basic

$4.99/mo

No contracts. Anytime cancellation.
1 API Key
1000 API Calls / day
Best in class backend tools
Easy to use REST API
Immediate provisioning

Fun Generators Facts API Premium

$9.99/mo

No contracts. Anytime cancellation.
1 API Key
5000 API Calls / day
Best in class backend tools
Easy to use REST API
Immediate provisioning

Fun Generators Facts API Ultra

$24.99/mo

No contracts. Anytime cancellation.
1 API Key
12500 API Calls / day
Best in class backend tools
Easy to use REST API
Immediate provisioning