Skip to Content
APIEndpointsGenerate prompt suggestions

Generate prompt suggestions

Starts the AI prompt-suggestion agent for one topic and, optionally, a set of its subtopics — the same flow as the “Suggest prompts” dialog in the app. Always proposes 8 suggestions per topic; that count is not configurable here, matching the dialog exactly.

This call returns immediately with a request_id. Generation runs in the background: poll Get prompt-suggestion run until status is completed or failed, then read the results with List prompt suggestions?request_id=....

Requires the write:prompts scope, and the workspace must be enabled for API writes.

POST /v1/brands/{brand_id}/prompts/suggestions/generate

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Body

application/json

FieldTypeRequiredDescription
parent_topic_iduuidrequiredThe root topic to generate for. From List topics
subtopic_idsuuid[], up to 15optionalSubtopics of parent_topic_id to generate for instead of the parent alone. Every id must be a direct child of parent_topic_id. Omit or send [] to target the parent topic itself
languagestring, 1-10 charsrequiredLanguage for the generated prompts, e.g. en
country_codestringoptionalMarket to generate for, e.g. US. Omit to leave suggestions unscoped to a market

Request

curl --request POST \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/prompts/suggestions/generate' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: 5b0e77d2-13a9-4f6a-8ce1-9a3f5e21c0aa' \ --header 'Content-Type: application/json' \ --data '{"parent_topic_id": "4beb0694-7c2e-488b-84c1-613738e7eaf6", "subtopic_ids": ["9c2b1a4e-5d3f-4b8c-9e1a-2f7c6d8b3a10"], "language": "en", "country_code": "US"}'

Response

{ "data": { "request_id": "3f1a9c2b-7e40-4b17-8e6a-3c05b91e7d22", "topic_ids": ["9c2b1a4e-5d3f-4b8c-9e1a-2f7c6d8b3a10"], "status": "queued" }, "request_id": "req_5b0e77d213a94f6a8ce1" }

Response fields

FieldTypeDescription
data.request_iduuidrequired. NOT the same as the envelope’s own request_id. Use this one with Get prompt-suggestion run and with List prompt suggestions’ request_id filter
data.topic_idsuuid[]required. The topics actually generated for — subtopic_ids if any were given, else [parent_topic_id]
data.statusstringrequired. Always queued at this point
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestUnknown field, missing parent_topic_id or language, or a subtopic_ids entry that is not a direct child of parent_topic_id
401invalid_tokenThe key is missing, malformed, or does not exist
403insufficient_scopeThe key does not carry write:prompts
403plan_requiredThis workspace is not enabled for API writes
404not_foundparent_topic_id does not exist for this brand, or this key is not allowed to reach it
429rate_limitedOver 60 requests per minute

Notes

There is no target_count. The app never exposes it either — every generation proposes 8 suggestions per topic. This endpoint mirrors the dialog, not the broader shape the background job technically accepts.

One parent topic per call, matching the dialog. Pick a different topic and call again if you need suggestions across several parts of the tree; there is no multi-parent-topic batching.

subtopic_ids replaces the parent, it does not add to it. Passing any subtopics generates for exactly those subtopics — not for the parent as well. Omit subtopic_ids (or send []) to target the parent topic on its own.

Last updated on