openapi: 3.0.3
info:
title: languagelayer Batch API
description: 'Language detection REST API that identifies 173 languages and accents from text with confidence scores, character usage statistics, and batch processing support, powered by an AI-based detection algorithm via the APILayer platform.
'
version: '1.0'
contact:
name: APILayer Support
email: support@apilayer.net
url: https://languagelayer.com/
termsOfService: https://languagelayer.com/terms
servers:
- url: https://apilayer.net/api
description: Production API server
security:
- accessKey: []
tags:
- name: Batch
paths:
/batch:
post:
operationId: batchDetectLanguage
summary: Batch Detect Languages
description: 'Identifies the language of multiple text strings in a single request, returning language detection results for each text supplied.
'
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
required:
- access_key
- query[]
properties:
access_key:
type: string
description: Your API access key obtained from languagelayer.com.
query[]:
type: array
items:
type: string
description: Array of text strings to detect languages for.
responses:
'200':
description: Successful batch language detection response.
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
example:
success: true
results:
- - language_code: en
language_name: English
probability: 78.4
percentage: 99.2
reliable_result: true
- - language_code: fr
language_name: French
probability: 81.2
percentage: 97.5
reliable_result: true
'401':
description: Unauthorized — missing or invalid access key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
tags:
- Batch
components:
schemas:
LanguageResult:
type: object
description: Language detection result for a single text.
properties:
language_code:
type: string
description: ISO 639-1 or ISO 639-2 language code (e.g. "en", "fr").
example: en
language_name:
type: string
description: Human-readable language name (e.g. "English").
example: English
probability:
type: number
format: float
description: 'Probability score indicating how strongly the language was matched, based on cross-referencing words, expressions, and grammatical constructions.
'
example: 78.4
percentage:
type: number
format: float
description: 'Confidence percentage indicating the API''s level of confidence that the detected language is correct.
'
example: 99.2
reliable_result:
type: boolean
description: 'Boolean flag indicating whether the detection result is considered reliable.
'
example: true
ErrorInfo:
type: object
description: Details about an API error.
properties:
code:
type: integer
description: Numeric error code.
example: 101
type:
type: string
description: Short error type identifier.
example: missing_access_key
info:
type: string
description: Human-readable error description.
example: You have not supplied an API Access Key.
BatchResponse:
type: object
description: Response object for a batch language detection request.
properties:
success:
type: boolean
description: Whether the API request was successful.
example: true
error:
$ref: '#/components/schemas/ErrorInfo'
results:
type: array
description: 'Array of result arrays, one per input text, each containing language detection results ordered by probability score.
'
items:
type: array
items:
$ref: '#/components/schemas/LanguageResult'
ErrorResponse:
type: object
description: Error response object.
properties:
success:
type: boolean
example: false
error:
$ref: '#/components/schemas/ErrorInfo'
securitySchemes:
accessKey:
type: apiKey
in: query
name: access_key
description: API access key obtained from languagelayer.com.
externalDocs:
description: Official Documentation
url: https://languagelayer.com/documentation