Ai generation

Generate one metadata field's value

POST/ai/generate-field

Generates a single AI-enabled field's value for a resource — the same path as the in-app "regenerate" button (description, keywords, BISAC/ Thema classification, and the other configured AI field types).

The generated value is returned but not saved. Persist it with PATCH /resources/{ref}/fields if you want to keep it.

Address the field by fieldRef or by fieldName (matched against the resource's AI-enabled fields; ambiguous names return 400 AMBIGUOUS_FIELD). Requires the ai key scope, a linked service user, and edit access to the resource.

Text fields run to completion synchronously and the finished value comes back in data.value; classification fields return the resolved nodeIds/nodeNames (their names joined into data.value).

X-Api-Key<token>

Issued to you when your integration is provisioned. Determines which catalogue resources are visible and which AI tools are available.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/ai/generate-field" \  -H "Content-Type: application/json" \  -d '{    "resourceRef": 0  }'
{  "data": {    "generationType": "text",    "value": "string",    "applied": true,    "fieldRef": 0,    "fieldName": "string",    "streamId": "string",    "nodeIds": [      0    ],    "nodeNames": [      "string"    ]  }}
{  "success": false,  "status": "fail",  "message": "string",  "error": {    "message": "API key is required",    "code": "NO_API_KEY"  }}

{  "success": false,  "status": "fail",  "message": "API key is required",  "error": {    "code": "NO_API_KEY",    "message": "API key is required"  }}

{  "success": false,  "status": "fail",  "message": "This API key does not have the 'write' scope",  "error": {    "code": "INSUFFICIENT_SCOPE",    "message": "This API key does not have the 'write' scope"  }}

{  "success": false,  "status": "fail",  "message": "string",  "error": {    "message": "API key is required",    "code": "NO_API_KEY"  }}
{  "success": false,  "status": "fail",  "message": "string",  "error": {    "message": "API key is required",    "code": "NO_API_KEY"  }}

Generate cover / A+ / concept / mock-up artwork POST

Runs the internal two-stage artwork pipeline for a resource: a concept model writes master prompts from the book metadata and cover, then the image model renders the first concept. Direct REST equivalent of the in-app artwork generator. **Synchronous.** Both stages block, so this call can take a while (tens of seconds to minutes) — it is genuinely synchronous, not job-queued. The rendered image is returned in the `{path, url}` shape; artwork lives outside the chat image tree, so its `url` points at `GET /ai/artwork/images` and is fetched with the `X-Api-Key` header (not a signed URL). Requires the `ai` key scope, a linked service user, and edit access to the resource. `asset_type` and `aspect_ratio` are required; all other artwork options (style, provider, A+ / mock-up settings) are accepted and forwarded verbatim to the internal generator.

Generate an image from a prompt POST

Generates an image directly from a text prompt — the same capability the chat `image_generation` tool provides, without needing a chat. Returns the image in the standard `{path, url}` shape; the `url` is a signed `GET /ai/images` URL valid for one hour, droppable straight into an `<img src>`. Requires the `ai` key scope and a linked service user. **Idempotency.** Image generation is expensive, so this endpoint honours the `Idempotency-Key` header: a retry with the same key **and** the same body within 24h replays the original response (`Idempotent-Replayed: true`) instead of generating a second image. Reusing a key with a different body returns `422 IDEMPOTENCY_KEY_CONFLICT`.