Ai generation

Generate an image from a prompt

POST/ai/images/generate

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.

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

Header Parameters

Idempotency-Key?string

Printable-ASCII key. Same key + same body within 24h replays the first response.

Lengthlength <= 255

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/images/generate" \  -H "Content-Type: application/json" \  -d '{    "prompt": "A watercolour fox reading a book under an oak tree"  }'
{  "data": {    "images": [      {        "path": "/chat_images/1024/gpt_307_stream_xxx.png",        "url": "https://example.veristage.com/api/external/ai/images?path=%2Fchat_images%2F1024%2Fgpt_307_stream_xxx.png&exp=1777565000&sig=<signature>"      }    ],    "prompt": "string",    "textResponse": "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"  }}