---
title: "Generate text content"
method: POST
path: "/magic-ai/content"
tags: ["Admin Magic AI"]
---

# Generate text content

`POST /magic-ai/content`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/magic-ai/content`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/magic-ai/content/post.ts> (a function with typed inputs; its response is checked against the schema)

Generates text from a prompt with the configured AI provider, the same way the admin editor's Magic AI button does. Requires Magic AI and its text generation feature to be enabled in Configuration → Magic AI.

## Request body

- object
  - `prompt` string, required
  - `model` string, nullable

## Response `200`

The generated text.

## Other responses

- `400`: Magic AI text generation is disabled.
- `401`: Missing or invalid admin token.
- `422`: Validation failed.
- `500`: The AI provider returned an error; `message` carries it.

## Changes

- **2026-10-28** `3198f11be70f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/bagisto/apis/bagisto-admin-api/changes/magic-ai/content/post.md)

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
