> ## Documentation Index
> Fetch the complete documentation index at: https://developers.myhero.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Transform text

> Applies a named transformation (`operation`) to the provided `text` and returns the rewritten string along with token `usage`.

Supported operations include rephrase, fix grammar, simplify, translate, shorten, summarize, and others.



## OpenAPI

````yaml post /ai-agent/transform-text
openapi: 3.1.0
info:
  title: HERO API
  version: current
  description: |-
    The HERO REST API.

    See https://developers.myhero.so for the rendered docs.
servers:
  - url: https://app.myhero.so
security: []
paths:
  /ai-agent/transform-text:
    post:
      tags:
        - AI
      summary: Transform text
      description: >-
        Applies a named transformation (`operation`) to the provided `text` and
        returns the rewritten string along with token `usage`.


        Supported operations include rephrase, fix grammar, simplify, translate,
        shorten, summarize, and others.
      operationId: aiTransformText
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  minLength: 1
                operation:
                  type: string
                  enum:
                    - rephrase
                    - restructure
                    - keypoints
                    - fixGrammar
                    - simplify
                    - professionalize
                    - bloggify
                    - emojify
                    - translate
                    - extend
                    - shorten
                    - complete
                    - summarize
                    - tldr
                language:
                  type: string
                  enum:
                    - FR
                    - EN
              required:
                - text
                - operation
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  text:
                    type: string
                  usage:
                    type: object
                    properties:
                      promptTokens:
                        type: integer
                        minimum: 0
                      completionTokens:
                        type: integer
                        minimum: 0
                      totalTokens:
                        type: integer
                        minimum: 0
                    required:
                      - promptTokens
                      - completionTokens
                      - totalTokens
                required:
                  - text
        '400':
          description: 400 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '401':
          description: 401 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '403':
          description: 403 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '429':
          description: 429 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: HERO personal access token

````