Smartling Language Detection API

The Language Detection API from Smartling — 1 operation(s) for language detection.

OpenAPI Specification

smartling-language-detection-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  contact:
    email: support@smartling.com
  description: 'Before you begin using the Smartling APIs, we recommend going through our [Developer documentation](https://help.smartling.com/hc/en-us/categories/1260801686149).

    '
  termsOfService: https://www.smartling.com/legal
  title: Smartling REST API Reference Account & Projects Language Detection API
  version: 2.0.0
  x-logo:
    url: smartling_logo.png
servers:
- url: https://api.smartling.com
tags:
- name: Language Detection
paths:
  /language-detection-api/v2/bulk/detect/language:
    post:
      summary: Detect language
      description: Request language detection for multiple texts. The request may include texts in multiple languages.
      tags:
      - Language Detection
      operationId: bulkDetectLanguage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetectLanguageRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectLanguageResponse'
              examples:
                response:
                  value:
                    response:
                      code: SUCCESS
                      data:
                        totalCount: 1
                        items:
                        - uid: uid-1
                          languages:
                          - languageId: en-US
                            probability: 0.99
                            localeIds:
                            - en-US
                            - en-GB
        '400':
          $ref: '#/components/responses/Error400ResponseDefinition'
        '401':
          $ref: '#/components/responses/Error401ResponseDefinition'
        '429':
          $ref: '#/components/responses/Error429ResponseDefinition'
        '500':
          $ref: '#/components/responses/Error500ResponseDefinition'
      x-code-samples:
      - lang: curl
        source: 'curl -X POST -H "Authorization: Bearer $smartlingToken" -H "Content-Type: application/json" -d "$requestBody" https://api.smartling.com/language-detection-api/v2/bulk/detect/language

          '
components:
  schemas:
    Error500Response:
      properties:
        response:
          properties:
            code:
              description: Indicates whether the response was successful or what error has occured.
              enum:
              - GENERAL_ERROR
              - MAINTENANCE_MODE_ERROR
              type: string
            errors:
              items:
                $ref: '#/components/schemas/Error'
              type: array
          required:
          - code
          - errors
          type: object
      required:
      - response
      type: object
    Error400Response:
      type: object
      properties:
        response:
          properties:
            code:
              description: Indicates whether the response was successful or what error has occured.
              enum:
              - VALIDATION_ERROR
              type: string
            errors:
              items:
                $ref: '#/components/schemas/Error'
              type: array
          required:
          - code
          - errors
          type: object
      required:
      - response
    SuccessResponse:
      properties:
        code:
          description: Indicates whether the response was successful or what error has occured.
          enum:
          - SUCCESS
          type: string
      required:
      - code
      type: object
    DetectLanguageItemInfoResponse:
      properties:
        languageId:
          description: A identifier of detected language
          example: en
          type: string
        probability:
          description: A probability of detected language
          example: '0.33'
          type: string
        localeIds:
          description: Possible localeIds for such language
          type: array
          example:
          - en-US
          - en-GB
          items:
            type: string
      type: object
    Error429Response:
      properties:
        response:
          properties:
            code:
              description: Indicates whether the response was successful or what error has occured.
              enum:
              - MAX_OPERATIONS_LIMIT_EXCEEDED
              type: string
            errors:
              items:
                $ref: '#/components/schemas/Error'
              type: array
          required:
          - code
          - errors
          type: object
      required:
      - response
      type: object
    DetectLanguageRequest:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DetectLanguageItemRequest'
          type: array
          maxItems: 100
      required:
      - items
      type: object
    DetectLanguageResponse:
      type: object
      required:
      - response
      properties:
        response:
          allOf:
          - $ref: '#/components/schemas/SuccessResponse'
          - properties:
              data:
                properties:
                  totalCount:
                    description: total number of items
                    type: integer
                  items:
                    items:
                      $ref: '#/components/schemas/DetectLanguageItemResponse'
                    type: array
                required:
                - items
                type: object
            type: object
    Error401Response:
      properties:
        response:
          properties:
            code:
              description: Indicates whether the response was successful or what error has occured.
              enum:
              - AUTHENTICATION_ERROR
              - AUTHORIZATION_ERROR
              type: string
            errors:
              items:
                $ref: '#/components/schemas/Error'
              type: array
          required:
          - code
          - errors
          type: object
      required:
      - response
      type: object
    Error:
      type: object
      properties:
        key:
          example: general_error
          type: string
        message:
          example: Unexpected server error
          type: string
        details:
          example: {}
          type: object
      required:
      - key
      - message
    DetectLanguageItemResponse:
      properties:
        uid:
          description: A unique identifier of requested text
          example: uid-1
          type: string
        languages:
          description: List of detected languageIds
          type: array
          items:
            $ref: '#/components/schemas/DetectLanguageItemInfoResponse'
      type: object
    DetectLanguageItemRequest:
      properties:
        uid:
          description: A unique identifier of requested text
          example: uid-1
          type: string
        text:
          description: The input text for language detection
          example: Test text
          type: string
      required:
      - uid
      - text
      type: object
  responses:
    Error400ResponseDefinition:
      description: Provided request parameters are invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error400Response'
          examples:
            response:
              value:
                response:
                  code: VALIDATION_ERROR
                  errors:
                  - key: unknown.field
                    message: The field unknown.parameter was not expected. Please consult the documentation to verify the fields you are submitting.
                    details: unknown.parameter
    Error500ResponseDefinition:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error500Response'
    Error429ResponseDefinition:
      description: Too many simultaneous API requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error429Response'
          examples:
            response:
              value:
                response:
                  code: MAX_OPERATIONS_LIMIT_EXCEEDED
                  errors:
                  - key: too.many.requests
                    message: The limit of 10 concurrent Smartling file API operations for this project has been exceeded.
    Error401ResponseDefinition:
      description: Provided credentials are not valid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error401Response'
          examples:
            response:
              value:
                response:
                  code: AUTHENTICATION_ERROR
                  errors:
                  - details: {}
                    key: invalid_token
                    message: Invalid token
externalDocs:
  description: Smartling Help Center
  url: https://help.smartling.com