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

# Write

> Write prose from a prompt. The prompt can be a plain request or notes to write from. Generation usually takes 10 to 20 seconds.



## OpenAPI

````yaml POST /write
openapi: 3.0.1
info:
  title: Simplex API
  description: API for browser automation, web scraping, and workflow automation
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.simplex.sh
security:
  - bearerAuth: []
paths:
  /write:
    post:
      description: >-
        Write prose from a prompt. The prompt can be a plain request or notes to
        write from. Generation usually takes 10 to 20 seconds.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WriteRequest'
            examples:
              linkedin:
                summary: LinkedIn post
                value:
                  prompt: >-
                    Write me a LinkedIn post about pivoting from vertical AI to
                    ML/RL.
              essay:
                summary: Essay from notes
                value:
                  prompt: >-
                    Write me an essay using the following info, make it about a
                    page:

                    - Senescent cells accumulate with age faster than the body
                    clears them.

                    - Removing them in mice improved many signs of aging.

                    - Senolytic drugs face safety questions, since senescent
                    cells also have useful roles.
      responses:
        '200':
          description: Generated prose
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteResponse'
        '401':
          description: Missing or invalid API key
        '422':
          description: Empty prompt, or longer than 8,000 characters
        '502':
          description: The writing model failed; retry the request
      x-codeSamples:
        - lang: python
          label: LinkedIn post
          source: >-
            import requests


            prompt = "Write me a LinkedIn post about pivoting from vertical AI
            to ML/RL."


            response = requests.post(
                "https://api.simplex.sh/write",
                headers={"X-API-Key": "your_api_key_here"},
                json={"prompt": prompt},
            )

            print(response.json()["text"])
        - lang: python
          label: Essay from notes
          source: >-
            import requests


            prompt = """Write me an essay using the following info, make it
            about a page:

            - Senescent cells accumulate with age faster than the body clears
            them.

            - Removing them in mice improved many signs of aging.

            - Senolytic drugs face safety questions, since senescent cells also
            have useful roles."""


            response = requests.post(
                "https://api.simplex.sh/write",
                headers={"X-API-Key": "your_api_key_here"},
                json={"prompt": prompt},
            )

            print(response.json()["text"])
        - lang: curl
          label: LinkedIn post
          source: |-
            curl -X POST "https://api.simplex.sh/write" \
              -H "X-API-Key: your_api_key_here" \
              -H "Content-Type: application/json" \
              -d '{"prompt": "Write me a LinkedIn post about pivoting from vertical AI to ML/RL."}'
        - lang: curl
          label: Essay from notes
          source: |-
            curl -X POST "https://api.simplex.sh/write" \
              -H "X-API-Key: your_api_key_here" \
              -H "Content-Type: application/json" \
              -d '{"prompt": "Write me an essay using the following info, make it about a page:\n- Senescent cells accumulate with age faster than the body clears them.\n- Removing them in mice improved many signs of aging.\n- Senolytic drugs face safety questions, since senescent cells also have useful roles."}'
components:
  schemas:
    WriteRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          maxLength: 8000
          description: >-
            What to write, up to 8,000 characters. Include any notes or an
            outline to write from, and the length you want.
          example: Write me a LinkedIn post about pivoting from vertical AI to ML/RL.
    WriteResponse:
      type: object
      properties:
        succeeded:
          type: boolean
          example: true
        text:
          type: string
          description: The generated prose.
          example: I spent the last two years building vertical AI products...
        word_count:
          type: integer
          description: Number of words in text.
          example: 412
        error:
          type: string
          nullable: true
          enum:
            - generation limit reached
            - null
          description: >-
            null when the prose finished normally. generation limit reached when
            it hit the output limit and may be cut off.
          example: null
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
              example: 34
            output_tokens:
              type: integer
              example: 530
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Simplex API Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.