---
title: "Generate Text"
method: POST
path: "/v1/text/generations"
tags: ["v1 text"]
---

# Generate Text

`POST /v1/text/generations`

Dedicated text generation endpoint using the Universal Schema with flat parameters.
    
    **Universal Base Schema:**
    - user_id (str, required): The end-user ID
    - project_id (str, required): The project ID
    - persona_id (str, optional): The specific system persona/voice to use
    - disabled_learning (bool, optional): If true, request is ignored by long-term memory
    - use_reasoning (bool, optional): Enable reasoning loop for generation
    
    **Input:**
    - text_input (str, optional): The prompt/description for text generation
    - session_id (str, optional): Session ID for conversation context

    **Reference inputs:**
    - image_base64 (str, optional): Base64 encoded reference image for context
    - video_base64 (str, optional): Base64 encoded reference video for context
    - audio_base64 (str, optional): Base64 encoded reference audio for context
    
    **Text Params (Flat):**
    - model (str, optional): LLM model to use (default: gpt-4.1-mini)
    
    **Authentication**: Requires valid API key or JWT token

## Request body

- TextGenerationRequest — Request model for text generation with Universal Schema + flat params
  - `user_id` string, required — The end-user ID
  - `project_id` string, nullable — The project ID
  - `persona_id` string, nullable — The specific system persona/voice to use
  - `disabled_learning` boolean — If true, this request is ignored by long-term memory
  - `use_reasoning` boolean — Enable Chain-of-Thought/Reasoning steps before generation
  - `max_reasoning_iterations` integer — Max reasoning steps if reasoning is enabled
  - `text_input` string, nullable — The prompt/description for text generation
  - `session_id` string, nullable — Session ID for conversation context
  - `image_base64` string, nullable — Base64 encoded reference image for context
  - `video_base64` string, nullable — Base64 encoded reference video for context
  - `audio_base64` string, nullable — Base64 encoded reference audio for context
  - `model` string — LLM model to use for generation
  - `output_schema` object, nullable — Optional JSON Schema describing the desired output structure. When provided, the LLM is forced to return a JSON object matching this schema instead of free-form text. The result is returned in the 'structured_output' field of the response.

## Response `200`

Successful Response

- TextGenerationResponse — Response model for text generation
  - `text` string, nullable — Generated text response (when no output_schema is provided)
  - `structured_output` object, nullable — Structured JSON output matching the requested output_schema (when output_schema is provided)
  - `success` boolean — Whether the request succeeded

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — User/Persona/Project Not Found
- `422` — Validation Error
- `500` — Internal Server Error

---

[API](https://skmtc.net/elicitlabs/apis/elicit-labs-api.md) · [All operations](https://skmtc.net/elicitlabs/apis/elicit-labs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elicitlabs/elicit-labs-api/revisions/27701839a070/schema)
