Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: Ninjas Riddles API
description: 'Combined OpenAPI specification for every API Ninjas endpoint. Requests go to https://api.api-ninjas.com with an `X-Api-Key` header; get a free key at https://api-ninjas.com/register. Human-readable docs: https://api-ninjas.com/api. Index for LLMs: https://api-ninjas.com/llms.txt.'
version: 1.0.0
contact:
name: API Ninjas
url: https://api-ninjas.com
license:
name: Proprietary
servers:
- url: https://api.api-ninjas.com
description: API Ninjas Production
security:
- ApiKeyAuth: []
tags:
- name: Riddles
description: The Riddles API provides quality riddles perfect for entertainment apps.
paths:
/v1/riddles:
get:
summary: Get Riddles
description: Returns one or more random riddles.
operationId: getRiddles
parameters:
- name: limit
in: query
description: Number of results to return. Must be between 1 and 20. Default is 1.
required: false
schema:
type: integer
default: 1
minimum: 1
maximum: 20
- $ref: '#/components/parameters/RiddlesOpenapi_safe'
responses:
'200':
$ref: '#/components/responses/RiddleResponse'
'400':
$ref: '#/components/responses/RiddlesOpenapi_BadRequest'
'401':
$ref: '#/components/responses/RiddlesOpenapi_Unauthorized'
'500':
$ref: '#/components/responses/RiddlesOpenapi_InternalServerError'
security:
- ApiKeyAuth: []
tags:
- Riddles
components:
responses:
RiddlesOpenapi_BadRequest:
description: Bad Request Response
content:
application/json:
schema:
$ref: '#/components/schemas/RiddlesOpenapi_Error'
RiddlesOpenapi_Unauthorized:
description: Unauthorized Response
content:
application/json:
schema:
$ref: '#/components/schemas/RiddlesOpenapi_Error'
RiddlesOpenapi_InternalServerError:
description: Internal Server Error Response
content:
application/json:
schema:
$ref: '#/components/schemas/RiddlesOpenapi_Error'
RiddleResponse:
description: A successful response containing one or more riddles.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Riddle'
schemas:
Riddle:
type: object
properties:
title:
type: string
description: The title of the riddle.
question:
type: string
description: The question part of the riddle.
answer:
type: string
description: The answer to the riddle.
required:
- title
- question
- answer
RiddlesOpenapi_Error:
type: object
properties:
message:
type: string
description: Error message describing the issue.
parameters:
RiddlesOpenapi_safe:
name: safe
in: query
description: Premium subscribers only. Set safe=true to exclude riddles flagged as sexually explicit, crude, or containing profanity, slurs, or offensive content. Defaults to false, so results are unfiltered unless you opt in. Filtering is best-effort and not a guarantee. Any value other than true/false returns an error, as does using this parameter on a free account.
required: false
schema:
type: boolean
default: false
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-Api-Key
externalDocs:
description: API Ninjas documentation
url: https://api-ninjas.com/api