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/generateAuthorization
| Header | Type | Required |
|---|---|---|
Authorization | Bearer asky_sk_… | required |
Idempotency-Key | string | required |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
brand_id | uuid | required | From List brands |
Body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
parent_topic_id | uuid | required | The root topic to generate for. From List topics |
subtopic_ids | uuid[], up to 15 | optional | Subtopics 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 |
language | string, 1-10 chars | required | Language for the generated prompts, e.g. en |
country_code | string | optional | Market to generate for, e.g. US. Omit to leave suggestions unscoped to a market |
Request
cURL
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
200
{
"data": {
"request_id": "3f1a9c2b-7e40-4b17-8e6a-3c05b91e7d22",
"topic_ids": ["9c2b1a4e-5d3f-4b8c-9e1a-2f7c6d8b3a10"],
"status": "queued"
},
"request_id": "req_5b0e77d213a94f6a8ce1"
}Response fields
| Field | Type | Description |
|---|---|---|
data.request_id | uuid | required. 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_ids | uuid[] | required. The topics actually generated for — subtopic_ids if any were given, else [parent_topic_id] |
data.status | string | required. Always queued at this point |
request_id | string | required. Also returned as the x-request-id header. Quote it when contacting support |
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | Unknown field, missing parent_topic_id or language, or a subtopic_ids entry that is not a direct child of parent_topic_id |
| 401 | invalid_token | The key is missing, malformed, or does not exist |
| 403 | insufficient_scope | The key does not carry write:prompts |
| 403 | plan_required | This workspace is not enabled for API writes |
| 404 | not_found | parent_topic_id does not exist for this brand, or this key is not allowed to reach it |
| 429 | rate_limited | Over 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.