---
title: "Generate a new script for an avatar."
method: POST
path: "/api/v1/scripts/generate"
tags: ["Scripts"]
---

# Generate a new script for an avatar.

`POST /api/v1/scripts/generate`

## Request

- Base URL: `https://api.avatarfactory.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.avatarfactory.io/api/v1/scripts/generate`
- Auth: one of:
  - API key in cookie `session`
  - HTTP bearer

<br/>Note: this creates a new script owned by the calling user. The<br/>`avatar_id` in the body must belong to the caller (or caller is<br/>admin); enforcement of this body-side check is a follow-up — the<br/>decorator currently only verifies the caller is logged in.

## Request body

- GenerateScriptBody
  - `avatar_id` integer, nullable
  - `length_seconds` integer
  - `pillar_name` string
  - `topic` string

## Response `200`

OK

- ServiceResponse

## Other responses

- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/avatarfactory/apis/avatarfactory-api.md) · [All operations](https://skmtc.dev/avatarfactory/apis/avatarfactory-api/llms.txt) · [OpenAPI document](https://skmtc.dev/avatarfactory/apis/avatarfactory-api/revisions/66fc7aa3f296?raw)
