Detect Language Detection API

Language detection endpoints

OpenAPI Specification

detect-language-detection-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Detect Language Account Detection API
  description: 'The Detect Language API identifies the language of a given text with high

    accuracy, supporting 164 languages. It accepts single or batch detection

    requests and returns confidence scores and reliability indicators.

    '
  version: '0.2'
  contact:
    name: Detect Language Support
    url: https://detectlanguage.com/
  license:
    name: Proprietary
    url: https://detectlanguage.com/terms
servers:
- url: https://ws.detectlanguage.com/0.2
  description: Production
security:
- bearerAuth: []
tags:
- name: Detection
  description: Language detection endpoints
paths:
  /detect:
    post:
      tags:
      - Detection
      summary: Detect language of text
      description: 'Detects the language of a given text. The request body may contain a

        single string under `q` or an array of strings for batch detection.

        '
      operationId: detectLanguage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetectRequest'
      responses:
        '200':
          description: Detection results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DetectResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            detections:
              oneOf:
              - type: array
                items:
                  $ref: '#/components/schemas/Detection'
              - type: array
                items:
                  type: array
                  items:
                    $ref: '#/components/schemas/Detection'
    DetectRequest:
      type: object
      required:
      - q
      properties:
        q:
          oneOf:
          - type: string
            description: Single text to detect
          - type: array
            items:
              type: string
            description: Batch of texts to detect
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: integer
    Detection:
      type: object
      properties:
        language:
          type: string
          description: ISO 639-1 language code
          example: en
        isReliable:
          type: boolean
          description: Whether the detection is considered reliable
        confidence:
          type: number
          format: float
          description: Confidence score; can exceed 100
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token using the API key issued in the Detect Language dashboard.