Skip to content

Generate an image

POST
/ai/image/generate
curl --request POST \
--url https://ai.work.optidata.cloud/api/ai/image/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "prompt": "A minimalist illustration of a team planning on a whiteboard." }'

Creates one image from a text description and returns it as base64 PNG. Generation can take up to a minute; use a generous client timeout.

Media typeapplication/json
object
prompt
required

Description of the image.

string

The image, base64-encoded.

Media typeapplication/json
object
id
required

Id of this request.

string
url
required

Always null; the image is returned inline.

string | null
image_base64
required

The PNG image, base64-encoded.

string
Examples
Exampleimage
{
"id": "a30508a1-7c2e-4b1d-9f3a-0e6d5c4b3a21",
"url": null,
"image_base64": "iVBORw0KGgoAAAANSUhEUgAA…"
}

No authentication key was sent.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The authentication key is expired or not recognised. Get a fresh one and retry.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Exampleexpired
{
"error": "JWT passport expired: Passport expired"
}

prompt was not sent.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
ExamplemissingPrompt
{
"message": "The prompt field is required.",
"errors": {
"prompt": [
"The prompt field is required."
]
}
}