Jokes API

The Jokes API provides access to a growing collection of jokes, including categories, search capabilities and random joke retrieval.

Base Endpoint
/api/jokes/[action]/[object]
Available Endpoints
Endpoint Description
/api/jokes List jokes.
/api/jokes/random Random joke.
/api/jokes/id/{id} Lookup joke by ID.
/api/jokes/type/{type} List jokes by type.
/api/jokes/types List available joke types.
/api/jokes/search/{query} Search jokes.
/api/jokes/recent Recently added jokes.
/api/jokes/count Database statistics.
Query Parameters
Parameter Example Description
limit 25 Maximum results returned.
type dad Filter by joke type.
active true Return active jokes only.
Examples
GET /api/jokes
GET /api/jokes?limit=50
GET /api/jokes/random
GET /api/jokes/random?type=programming
GET /api/jokes/id/42
GET /api/jokes/type/dad
GET /api/jokes/type/programming
GET /api/jokes/types
GET /api/jokes/search/chicken
GET /api/jokes/recent?limit=10
GET /api/jokes/count
Example Joke Response
{
    "id": 42,
    "type": "programming",
    "setup": "Why do programmers prefer dark mode?",
    "punchline": "Because light attracts bugs.",
    "active": true,
    "created_at": "2026-11-04T00:00:00+00:00",
    "updated_at": "2026-11-04T00:00:00+00:00"
}
Example Types Response
[
    {
        "type": "dad",
        "joke_count": 250
    },
    {
        "type": "programming",
        "joke_count": 180
    },
    {
        "type": "knock-knock",
        "joke_count": 95
    }
]
Example Statistics Response
{
    "total": 1250,
    "active": 1220,
    "inactive": 30,
    "types": 12
}

Authentication & Rate Limits

All Jarvis APIs require a valid API token. Tokens are issued through the Jarvis Developer Portal and are associated with an account plan which determines access levels and request limits.

Authentication

Every request must include a valid API token. Requests made without a token or with an invalid token will be rejected.

Authorization Header (Recommended)
Authorization: YOUR_API_TOKEN
X-API-Token Header
X-API-Token: YOUR_API_TOKEN
Query String
GET /api/flags/random?token=YOUR_API_TOKEN
For security reasons, the Authorization header method is strongly recommended. Avoid exposing API tokens in URLs where possible.
Example Requests
cURL
curl \
-H "Authorization: YOUR_API_TOKEN" \
https://jarvisbot.uk/api/flags/random
JavaScript (Fetch)
fetch("https://jarvisbot.uk/api/jokes/random", {
    headers: {
        "Authorization": "YOUR_API_TOKEN"
    }
})
.then(r => r.json())
.then(console.log);
PHP
$response = file_get_contents(
    "https://jarvisbot.uk/api/questions/random",
    false,
    stream_context_create([
        'http' => [
            'header' => [
                'Authorization: YOUR_API_TOKEN'
            ]
        ]
    ])
);

$data = json_decode($response, true);
Account Plans
Plan Daily Requests API Access
Free 100 Requests Basic APIs
Premium 10,000 Requests All APIs
Enterprise Unlimited All APIs + Priority Support
Rate Limiting

API usage is automatically monitored based on your account type. Once your limit is reached, requests will be temporarily blocked until your allowance resets.

Plan Limit Window
Free 100 Requests 24 Hours
Premium 10,000 Requests 24 Hours
Enterprise Unlimited No Restriction
Authentication Error Response
{
    "success": false,
    "error": "invalidToken",
    "msg": "API token required"
}
Invalid Token Response
{
    "success": false,
    "error": "invalidToken",
    "msg": "Invalid API token"
}
Rate Limit Response
{
    "success": false,
    "error": "rateLimit",
    "msg": "API limit exceeded",
    "plan": "free",
    "limit": 100
}
Best Practices
  • Store API tokens securely and never expose them publicly.
  • Use the Authorization header whenever possible.
  • Cache responses where appropriate to reduce API calls.
  • Monitor your daily usage to avoid rate limiting.
  • Upgrade your account if your application requires higher throughput.
Supported APIs
  • Flags API
  • Dictionary API
  • Questions API
  • Riddles API
  • Jokes API
  • Pickup Lines API
  • Truth Or Dare API
  • Harry Potter Spells API
  • Future Jarvis APIs
Need additional capacity or custom limits? Contact the Jarvis team to discuss Premium and Enterprise API access.