# Generate Sending Text

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/ml/sending/generate_text:
    post:
      summary: Generate Sending Text
      deprecated: false
      description: >-
        Generates sending text.


        ## Body Parameters


        | Parameter        | Type          | Required? |
        Description                                                  |

        |------------------|---------------|-----------|--------------------------------------------------------------|

        | about            | String        | yes       | What about the text
        should be.                               |

        | include_keywords | Array[String] | yes       | Keywords that should be
        included.                            |

        | word_limit       | Integer       | yes       | Text limit in
        words.                                         |

        | tone             | String        | yes       | Tone of the text, e.g
        `engaging`, `emotional`.               |

        | occasion         | String        | yes       | Occasion of sending,
        e.g `christmas`, `valentines`           |

        | variation        | String        | yes       | How varied should text
        be, options: `none`, `medium`, `high` |

        | target_language  | String        | yes       | Language in ISO format,
        e.g. `pl`, `en`.                     |



        Parameters like: `about`, `include_keywords` (Array[String]), occasion,
        can be in any language supported by deepl.

        (https://www.deepl.com/docs-api/translate-text/). Each parameter will be
        translated from `target_language` to `en` to build full prompt in
        English.

        After that we concatenate the prompt as follows: ```PROMPT + 'Use
        {target_language} language.'```.

        Where `target_language` (in ISO format) will me mapped to
        target_language in full name format `e.g pl -> Polish...`


        ## Example


        ```shell

        curl -X POST \
            "https://api.mpc.placewise.com/v1/ml/sending/generate_text"  \
            -H 'Content-Type: application/json' \
            -H 'Authorization: Bearer B7t9U9tsoWsGhrv2ouUoSqpM' \
            -H 'x-product-name: default' \
            -H 'x-user-agent: CURL manual test' \
            -d \
                '{ 
                "about": "Big release!",
                "include_keywords": ["new app", "promotion", "code"],
                "word_limit": 60,
                "tone": "engaging",
                "occasion": "new fresh application release",
                "variation": "none",
                "target_language": "pl"
                }'
        ```


        > When successful, returns:

        ```

        {
            'sending_text_generation_task': {
                'id': 1
            }
        }

        ```
      tags:
        - API Reference/ML API
      parameters:
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                about:
                  type: string
                include_keywords:
                  type: array
                  items:
                    type: string
                  nullable: true
                word_limit:
                  type: integer
                tone:
                  type: string
                occasion:
                  type: string
                  nullable: true
                variation:
                  type: string
                  enum:
                    - none
                    - medium
                    - high
                  x-apidog-enum:
                    - value: none
                      name: ''
                      description: ''
                    - value: medium
                      name: ''
                      description: ''
                    - value: high
                      name: ''
                      description: ''
                target_language:
                  type: string
              x-apidog-orders:
                - about
                - include_keywords
                - word_limit
                - tone
                - occasion
                - variation
                - target_language
              required:
                - about
                - include_keywords
                - word_limit
                - tone
                - occasion
                - variation
                - target_language
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: API Reference/ML API
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3511404-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```