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
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Content-Type | Required. application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the asset. |
description | string | No | Description of the asset, added to the prompt. |
category_name | string | No | Category name, added to the prompt next to the name. |
token_symbol | string | No | Used for the file name only (<symbol>-ai-<unix time>.jpg; asset when empty). |
instruction | string | No | Free-text direction appended to the prompt, at most 1000 characters. |
provider | string | No | AI 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
| Field | Type | Description |
|---|---|---|
file_name | string | Suggested file name. |
content_type | string | Media type of the image. |
data_base64 | string | The image, base64-encoded. |
provider | string | Provider that drew the image. |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10015 | Validation failed (name missing, instruction over 1000 characters) — see details |
| 400 | 79001 | provider is not a supported provider (AI provider setting domain 79) |
| 400 | 79005 | The named provider is disabled, not configured, or not enabled for tokenization images (domain 79) |
| 400 | 79006 | No provider is enabled for tokenization images (domain 79) |
| 400 | 77004 | The provider has no image model configured (AI client domain 77) |
| 400 | 77005 | The provider does not generate images (AI client domain 77) |
See Errors for the error format and common codes.