TextGears Exceptions API

Custom exception (whitelist) management

OpenAPI Specification

textgears-exceptions-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: TextGears Account Exceptions API
  description: TextGears is a grammar checking and text analysis REST API providing spelling corrections, grammar error detection, readability scoring, language detection, text summarization, and custom dictionary management across 11 languages. The service processes over 10.8 million API requests daily with distributed infrastructure across Estonia, Singapore, and the United States.
  version: 1.0.0
  contact:
    url: https://textgears.com
  termsOfService: https://textgears.com/terms
  license:
    name: Commercial
    url: https://textgears.com
servers:
- url: https://api.textgears.com
  description: Auto-routing (recommended)
- url: https://eu.api.textgears.com
  description: Europe
- url: https://us.api.textgears.com
  description: United States
- url: https://sg.api.textgears.com
  description: Asia (Singapore)
security:
- apiKeyQuery: []
- apiKeyHeader: []
tags:
- name: Exceptions
  description: Custom exception (whitelist) management
paths:
  /custom/addexception:
    post:
      operationId: addException
      summary: Add dictionary exception
      description: Adds a word or phrase exception to a custom dictionary.
      tags:
      - Exceptions
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ExceptionRequest'
          application/json:
            schema:
              $ref: '#/components/schemas/ExceptionRequest'
      responses:
        '200':
          description: Created exception details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
  /custom/listexceptions:
    get:
      operationId: listExceptions
      summary: List dictionary exceptions
      description: Returns a paginated list of exceptions for a custom dictionary.
      tags:
      - Exceptions
      parameters:
      - name: limit
        in: query
        required: true
        description: Maximum number of exceptions to return
        schema:
          type: integer
          minimum: 1
          maximum: 100
      - name: offset
        in: query
        description: Number of exceptions to skip (for pagination)
        schema:
          type: integer
          minimum: 0
          default: 0
      - name: dictionary_id
        in: query
        description: Filter exceptions by dictionary ID
        schema:
          type: string
      - name: text
        in: query
        description: Filter exceptions by text content
        schema:
          type: string
      - name: type
        in: query
        description: Filter exceptions by type (1=word, 2=phrase)
        schema:
          type: integer
          enum:
          - 1
          - 2
      - name: lang
        in: query
        description: Filter exceptions by language code
        schema:
          type: string
      responses:
        '200':
          description: List of exceptions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionListResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
  /custom/deleteexception:
    post:
      operationId: deleteException
      summary: Delete dictionary exception
      description: Removes an exception from a custom dictionary.
      tags:
      - Exceptions
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: string
                  description: Exception identifier
                dictionary_id:
                  type: string
                  description: Dictionary identifier containing the exception
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: string
                  description: Exception identifier
                dictionary_id:
                  type: string
                  description: Dictionary identifier containing the exception
      responses:
        '200':
          description: Deletion confirmation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
components:
  schemas:
    ExceptionResponse:
      type: object
      properties:
        status:
          type: boolean
        response:
          type: object
          properties:
            id:
              type: string
            text:
              type: string
            type:
              type: integer
            lang:
              type: string
            dictionary_id:
              type: string
    ExceptionListResponse:
      type: object
      properties:
        status:
          type: boolean
        response:
          type: object
          properties:
            items:
              type: array
              items:
                $ref: '#/components/schemas/ExceptionResponse/properties/response'
            total:
              type: integer
    SuccessResponse:
      type: object
      properties:
        status:
          type: boolean
          example: true
        response:
          type: object
    ErrorResponse:
      type: object
      properties:
        status:
          type: boolean
          example: false
        error_code:
          type: integer
          description: Error code
          enum:
          - 500
          - 501
          - 600
          - 606
          - 607
        description:
          type: string
          description: Human-readable error description
    ExceptionRequest:
      type: object
      required:
      - text
      - type
      - lang
      properties:
        text:
          type: string
          description: Word or phrase to add as exception
        type:
          type: integer
          description: Exception type (1=word, 2=phrase)
          enum:
          - 1
          - 2
        lang:
          type: string
          description: Language code for the exception
        dictionary_id:
          type: string
          description: Dictionary to add the exception to
        description:
          type: string
          description: Optional description of the exception
        suggestions:
          type: array
          items:
            type: string
          description: Alternative suggestions to offer instead of this exception
  responses:
    ErrorResponse:
      description: API error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidKey:
              summary: Invalid API key
              value:
                status: false
                error_code: 600
                description: Invalid key
            rateLimitExceeded:
              summary: Rate limit exceeded
              value:
                status: false
                error_code: 607
                description: Request limit exceeded
  securitySchemes:
    apiKeyQuery:
      type: apiKey
      in: query
      name: key
      description: API key passed as a query parameter
    apiKeyHeader:
      type: http
      scheme: basic
      description: API key passed as HTTP Basic Authorization header value