openapi: 3.0.1
info:
  title: ReadEasy.ai
  description: This REST API provides endpoints that allows users to improve the
    readability of their text using artificial intelligence. It analyzes the text
    and provide suggestions for improving its readability, such as rephrasing long
    or complex sentences, suggesting simpler words and providing better punctuation.
    With this API, users can easily enhance the quality of their written content,
    making it more accessible and understandable to a wider audience. This API can
    be integrated into various applications, such as writing tools, content management
    systems, and educational platforms, to help users improve the readability of their
    text and communicate more effectively.
  termsOfService: https://readeasy.ai/terms-of-use/
  contact:
    name: ReadEasy.ai
    url: https://readeasy.ai/contact/
  version: 1.0.0
servers:
  - url: https://api.readeasy.ai/v1
tags:
  - name: Text
    description: Text completion functions
  - name: Words
    description: Words completion functions
  - name: Sentences
    description: Sentences completion functions
  - name: Dyslexia
    description: Dyslexia completion functions
  - name: Profile
    description: User profile functions
  - name: Key
    description: API Key functions
paths:
  /text/makeReadable:
    post:
      tags:
        - Text
      summary:
        Generates a readable version of the provided text with the specified
        age and language.
      operationId: makeReadable
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to make readable
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MakeReadableText"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MakeReadableTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
  /text/explain:
    post:
      tags:
        - Text
      summary: Generates an explanation if the provided text can be understandable or why not with the specified language.
      operationId: explain
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get explanation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/explain"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/explainTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"              
  /text/showHighlights:
    post:
      tags:
        - Text
      summary: Generates the highligts of the provided text with the specified language.
      operationId: showHighlights
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to list highlights
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/showHighlights"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/showHighlightsTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
  /words/list:
    post:
      tags:
        - Words
      summary: Generates an list of all difficult words/phrase and they synonyms with the specified language.
      operationId: list
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get a list of words and they alternatives
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/list"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/listTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                            
  /words/listWithoutExplanation:
    post:
      tags:
        - Words
      summary: Generates a list of all nonunderstandable words/phrase of a given text with the specified language.
      operationId: explain
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get list of words without explanation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/listWithoutExplanation"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/listWithoutExplanationTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                            
  /sentences/rewrite:
    post:
      tags:
        - Sentences
      summary: Generates understandable version od all difficult sentences/phrase of a given text with the specified language.
      operationId: rewrite
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get a new rewritten sentences/phrases
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/rewrite"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/rewriteTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                  
  /sentences/listDifficult:
    post:
      tags:
        - Sentences
      summary: Generates a list of all nonunderstandable words/phrase from the text with the specified language.
      operationId: listDifficult
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get all not understandable phrase/sentences
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/listDifficult"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/listDifficultTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                                       
  /dyslexia/listComplexWords:
    post:
      tags:
        - Dyslexia
      summary: Generates the highlights with all words/phrase/sentences that are difficult to read or understand for somebody who has dyslexia from the text with the specified language.
      operationId: listComplexWords
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to list highlights with all words/phrase/sentences
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/listComplexWords"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/listComplexWordsTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                                                     
  /dyslexia/rewrite:
    post:
      tags:
        - Dyslexia
      summary: Generates understandable version of the provided text with the specified with the specified language.
      operationId: rewrite
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to make understandable
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/rewrite"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/rewriteTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                                                     
  /dyslexia/explain:
    post:
      tags:
        - Dyslexia
      summary: Generates an explanation for all nonunderstandable words and proposing alternatives with the specified language.
      operationId: explain
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get explanation of words
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/explain"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/explainTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                                                                   
  /dyslexia/listWords:
    post:
      tags:
        - Dyslexia
      summary: Generates a list of all nonunderstandable words with the specified language.
      operationId: listWords
      parameters:
        - in: header
          name: Content-Language
          description: Language in ISO 639-1 format (eg. `en` or `nl`)
          schema:
            $ref: "#/components/schemas/LanguageHeader"
      requestBody:
        description: Text object to get a list of words
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/listWords"
        required: true
      responses:
        200:
          description: Successful Ooperation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/listWordsTextResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"                                                                                       
  /key:
    get:
      tags:
        - Key
      summary: Returns the current API key details
      operationId: getKey
      responses:
        200:
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KeyResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
    post:
      tags:
        - Key
      summary: Generate (new) API key
      operationId: generateKey
      responses:
        201:
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KeyResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
  /profile:
    get:
      tags:
        - Profile
      summary: Returns the current user details
      operationId: getProfile
      responses:
        200:
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
    patch:
      tags:
        - Profile
      summary: Updates the details of the current user
      operationId: updateProfile
      requestBody:
        description: User object to update
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProfileRequest"
        required: true
      responses:
        200:
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileResponse"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
    LanguageHeader:
      type: string
      default: en
    MakeReadableText:
      required:
        - text
      type: object
      properties:
        text:
          type: string
        age:
          type: number
    MakeReadableTextResponse:
      type: object
      properties:
        text:
          type: string
    ListHighligtText:
      required:
        - text
      type: object
      properties:
        text:
          type: string
    ListHighligtTextResponse:
      type: object
      properties:
        text:
          type: string
    KeyResponse:
      type: object
      properties:
        apiKey:
          type: string
        expires:
          type: number
    ProfileRequest:
      type: object
      properties:
        companyName:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        language:
          type: string
    ProfileResponse:
      type: object
      properties:
        email:
          type: string
        companyName:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        language:
          type: string
        limit:
          type: object
          properties:
            remaining:
              type: number
            total:
              type: number
        createdAt:
          type: number
        updatedAt:
          type: number
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-KEY
      in: header
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
