Unbabel Word Count API

Billable word count calculation for a block of text.

OpenAPI Specification

unbabel-word-count-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Unbabel Translation Account Word Count API
  description: 'The Unbabel Translation API (tapi/v2) is an asynchronous REST API for the Unbabel Language Operations (LangOps) platform. Callers submit text with a source/target language pair, tone, and topic; Unbabel returns a job identifier (uid) immediately and processes the translation with always-on AI plus optional human review. Results are retrieved by uid, by listing jobs by status, or delivered to a callback URL. The API also exposes a pure machine-translation path (mt_translation) and helper resources for language pairs, tones, topics, word count, and account details.

    Authentication uses a token header of the form `Authorization: ApiKey <username>:<api_key>`. The production base URL is https://api.unbabel.com/tapi/v2 and a sandbox is available at https://sandbox.unbabel.com/tapi/v2. Endpoints for translation, mt_translation, language_pair, tone, topic, account, and wordcount are confirmed from Unbabel''s public developer docs and the official unbabel-py client; the asynchronous callback (webhook) payload is modeled from the documented callback behavior.'
  version: '2.0'
  contact:
    name: Unbabel Developers
    url: https://developers.unbabel.com
servers:
- url: https://api.unbabel.com/tapi/v2
  description: Production
- url: https://sandbox.unbabel.com/tapi/v2
  description: Sandbox
security:
- apiKeyAuth: []
tags:
- name: Word Count
  description: Billable word count calculation for a block of text.
paths:
  /wordcount/:
    post:
      operationId: calculateWordCount
      tags:
      - Word Count
      summary: Calculate word count
      description: Calculates the billable word count for a block of text.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - text
              properties:
                text:
                  type: string
                  description: The text whose words should be counted.
                text_format:
                  type: string
                  enum:
                  - text
                  - html
                  - xliff
                  default: text
      responses:
        '200':
          description: The calculated word count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  word_count:
                    type: integer
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    BadRequest:
      description: The request was malformed or missing required parameters.
    Unauthorized:
      description: Missing or invalid API credentials.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Token authentication of the form `Authorization: ApiKey <username>:<api_key>`.'