Ai generation

Research Amazon book keywords

POST/ai/keyword-research

Researches Amazon search-volume and competition metrics for a set of seed terms (comparable authors, series, distinctive titles, seasonal search phrases). Direct REST equivalent of the chat book_keyword_research tool.

Requires the ai key scope and a linked service user. When marketplace is omitted it defaults to the linked user's usergroup market (never a hardcoded US).

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

curl -X POST "https://example.com/ai/keyword-research" \  -H "Content-Type: application/json" \  -d '{    "keywords": [      "lessons in chemistry",      "bonnie garmus",      "book club picks 2026"    ]  }'
{  "data": {    "keywords": [      "string"    ],    "marketplace": "uk",    "totalResults": 0,    "results": [      {        "name": "lessons in chemistry",        "monthly_search_volume_exact": 5400,        "monthly_search_volume_broad": 0,        "monthly_trend": 0,        "quarterly_trend": 0,        "relevancy_score": 0,        "organic_product_count": 0,        "search_origin": "string"      }    ],    "errors": [      "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"  }}

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`.

Stream a chat image GET

Returns image bytes for an image saved by the chat pipeline (either attached by the caller or generated by `image_generation`). ### Two auth modes - **Signed URL** (preferred for browsers): pass `path`, `exp`, `sig` query params as returned in the `images[i].url` field of a chat response. The signature is validated and bytes are served without an api-key. URLs expire after 1 hour. - **API key** (server-to-server): send `X-Api-Key` and `path` only. The path is checked against the api-key's scope; you can only fetch images that belong to chats the api-key would otherwise be able to read. Inline image refs in `chatResponse` HTML are auto-rewritten to signed-URL form, so customers rendering the response HTML directly get working `<img src>` tags out of the box.