Skip to main content

Generate Tokenization Image

Draws an image of the asset for a new token's form with an AI provider. The picture is drawn from the values you send (name, and when given category_name, description and a free-text instruction) with a fixed prompt; nothing is read from the store, so the token does not need to exist yet. Nothing is stored either: the image comes back base64-encoded, ready to be uploaded as one of the token's images in Create Token or Update Token.

Without provider, the first provider serving tokenization images draws; list them with Get Tokenization Providers and feature=tokenization_image.

Required permission: token:ai-assist

Request​

POST /v2/admin/tokens/tokenization-images

Headers​

NameDescription
AuthorizationRequired. Bearer <access_token>
Content-TypeRequired. application/json

Body​

FieldTypeRequiredDescription
namestringYesName of the asset.
descriptionstringNoDescription of the asset, added to the prompt.
category_namestringNoCategory name, added to the prompt next to the name.
token_symbolstringNoUsed for the file name only (<symbol>-ai-<unix time>.jpg; asset when empty).
instructionstringNoFree-text direction appended to the prompt, at most 1000 characters.
providerstringNoAI provider to draw with. It must be configured and enabled for tokenization images; only a provider that can draw images (today openai) can be.

Example​

curl --request POST \
--url '{{baseUrl}}/v2/admin/tokens/tokenization-images' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"provider": "openai",
"name": "Istanbul Commercial Office",
"description": "12 month lease contract on a commercial real estate in Istanbul",
"token_symbol": "IST",
"category_name": "Real Estate",
"instruction": "dusk light, exterior view"
}'

Response​

{
"file_name": "ist-ai-1762682400.jpg",
"content_type": "image/jpeg",
"data_base64": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
"provider": "openai"
}

Response Fields​

FieldTypeDescription
file_namestringSuggested file name.
content_typestringMedia type of the image.
data_base64stringThe image, base64-encoded.
providerstringProvider that drew the image.

Errors​

StatusCodeDescription
40010015Validation failed (name missing, instruction over 1000 characters) — see details
40079001provider is not a supported provider (AI provider setting domain 79)
40079005The named provider is disabled, not configured, or not enabled for tokenization images (domain 79)
40079006No provider is enabled for tokenization images (domain 79)
40077004The provider has no image model configured (AI client domain 77)
40077005The provider does not generate images (AI client domain 77)

See Errors for the error format and common codes.