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 Text 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: Text
paths:
/v1/dictionary:
get:
tags:
- Text
summary: Look up word definition
description: Returns a string containing definitions for a given word.
operationId: getDefinition
parameters:
- name: word
in: query
description: Word to look up.
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/DictionaryResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/DictionaryOpenapi_ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/DictionaryOpenapi_ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/DictionaryOpenapi_ErrorResponse'
security:
- ApiKeyAuth: []
/v1/profanityfilter:
get:
tags:
- Text
summary: Detects and censors profanity in text
description: Screens `text` for profanity and returns a censored version plus a flag indicating whether anything was found. Requires `text`.
operationId: filterProfanity
parameters:
- $ref: '#/components/parameters/TextParam'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ProfanityFilterResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ProfanityFilterOpenapi_ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ProfanityFilterOpenapi_ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ProfanityFilterOpenapi_ErrorResponse'
security:
- ApiKeyAuth: []
/v1/textlanguage:
get:
tags:
- Text
summary: Detects the language of the given text
description: Detects which language a text is written in, across over 50 supported languages. Requires `text` of at most 1000 characters.
operationId: detectLanguage
parameters:
- name: text
in: query
description: Input text (10 words or more recommended). Maximum 1000 characters.
required: true
schema:
type: string
maxLength: 1000
responses:
'200':
$ref: '#/components/responses/LanguageDetectionSuccess'
'400':
$ref: '#/components/responses/TextLanguageOpenapi_BadRequest'
'401':
$ref: '#/components/responses/TextLanguageOpenapi_Unauthorized'
'500':
$ref: '#/components/responses/TextLanguageOpenapi_InternalServerError'
security:
- ApiKeyAuth: []
/v1/thesaurus:
get:
tags:
- Text
summary: Get synonyms and antonyms for a word
description: Returns the synonyms (similar words) and antonyms (opposite meanings) of a single English word. Requires a `word` to look up.
operationId: getThesaurus
parameters:
- name: word
in: query
description: Word to look up.
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ThesaurusResponse'
'400':
description: Bad Request
'401':
description: Unauthorized
'500':
description: Internal Server Error
security:
- ApiKeyAuth: []
components:
schemas:
TextLanguageOpenapi_ErrorResponse:
type: object
properties:
message:
type: string
description: Description of the error.
DictionaryOpenapi_ErrorResponse:
type: object
properties:
message:
type: string
description: Error message describing the failure.
code:
type: integer
format: int32
description: HTTP status code.
DictionaryResponse:
type: object
properties:
definition:
type: string
description: The definition of the requested word.
word:
type: string
description: The word that was looked up.
valid:
type: boolean
description: Indicates if the word is valid.
LanguageDetectionResponse:
type: object
properties:
iso:
type: string
description: 2-letter ISO language code.
language:
type: string
description: The full name of the detected language.
ProfanityFilterOpenapi_ErrorResponse:
type: object
properties:
error:
type: string
description: Error message describing the issue.
code:
type: integer
format: int32
description: HTTP status code.
ProfanityFilterResponse:
type: object
properties:
original:
type: string
description: The original input text.
censored:
type: string
description: The censored version of the input text, with profanity replaced by asterisks.
has_profanity:
type: boolean
description: Indicates whether the input text contains profanity.
ThesaurusResponse:
type: object
properties:
word:
type: string
example: elegant
synonyms:
type: array
items:
type: string
example:
- graceful
- handsome
- fine
antonyms:
type: array
items:
type: string
example:
- inelegant
- unfashionable
- tasteless
parameters:
TextParam:
name: text
in: query
description: Input text. Maximum 1000 characters.
required: true
schema:
type: string
maxLength: 1000
responses:
LanguageDetectionSuccess:
description: Language detection successful.
content:
application/json:
schema:
$ref: '#/components/schemas/LanguageDetectionResponse'
TextLanguageOpenapi_BadRequest:
description: Bad request, possibly due to missing or invalid parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/TextLanguageOpenapi_ErrorResponse'
TextLanguageOpenapi_Unauthorized:
description: Unauthorized, possibly due to missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/TextLanguageOpenapi_ErrorResponse'
TextLanguageOpenapi_InternalServerError:
description: Internal server error.
content:
application/json:
schema:
$ref: '#/components/schemas/TextLanguageOpenapi_ErrorResponse'
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-Api-Key
externalDocs:
description: API Ninjas documentation
url: https://api-ninjas.com/api