Generate alignment suggestions
Starts the AI agent that proposes new alignment prompts for a brand — the same flow as the
“Suggest prompts” action on the Brand Alignment page. Unlike the regular-prompts side, there is no
parent_topic_id: alignment prompts are grouped by category instead of topic, and the generation
mode is resolved for you.
The brand’s profile must already have a short description or an industry set. Calling this before
either is filled in fails with invalid_request.
This call returns immediately with a request_id. Generation runs in the background. There is no
separate run-status endpoint for this flow: poll
List alignment suggestions?request_id=...&status=proposed
directly until rows stop arriving.
Requires the write:alignment scope, and the workspace must be enabled for API writes.
POST /v1/brands/{brand_id}/alignment/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 |
|---|---|---|---|
language | string, 1-10 chars | optional | Defaults to the brand’s prompt language, then en |
country_codes | string[], up to 20 | optional | Markets for the generated prompts |
category_ids | uuid[], up to 20 | optional | Target these existing categories instead of proposing new ones, from List alignment categories. Ids that do not belong to this brand are ignored, not rejected |
Request
cURL
curl --request POST \
--url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/alignment/suggestions/generate' \
--header 'Authorization: Bearer <api-key>' \
--header 'Idempotency-Key: 5b0e77d2-13a9-4f6a-8ce1-9a3f5e21c0aa' \
--header 'Content-Type: application/json' \
--data '{"language": "en", "country_codes": ["US"], "category_ids": ["b8d4f261-3a9c-4e17-8f52-6d1a9c4e8b30"]}'Response
200
{
"data": {
"request_id": "7f3ab21c-9e4d-4b8a-8f1a-2c9d6e4b7a30",
"mode": "category_targeted"
},
"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 List alignment suggestions’ request_id filter |
data.mode | string | required. Resolved server-side, one of first_fill, category_targeted, general — see Notes |
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, or this brand’s profile has neither a short description nor an industry set |
| 401 | invalid_token | The key is missing, malformed, or does not exist |
| 401 | token_expired | The key passed its expiry date |
| 401 | token_revoked | The key was revoked |
| 403 | insufficient_scope | The key does not carry write:alignment |
| 403 | plan_required | This workspace is not enabled for API writes |
| 403 | plan_required | Brand alignment is not included in this workspace’s current plan |
| 404 | not_found | The brand does not exist, or this key is not allowed to reach it |
| 429 | rate_limited | Over 60 requests per minute |
| 503 | service_unavailable | Your plan allowance could not be checked. Retry shortly |
Notes
You never pick the mode. It is resolved server-side from what you pass and the brand’s current state:
category_targeted— you passedcategory_idsand at least one resolves to a category this brand actually owns.first_fill— otherwise, if the brand has zero active alignment prompts yet: generation fills toward the plan’s allowance, capped at 30 suggestions.general— otherwise: a general spread of new categories and prompts.
There is no run-status endpoint. Unlike Generate prompt
suggestions, which has Get prompt-suggestion
run, the alignment side has nothing to poll but the
list itself. Poll List alignment suggestions with
request_id and the default status=proposed filter until rows stop arriving.
Complete the brand profile first. A short description or an industry must be set on the brand before any generation call, AI-generated or hand-written, will succeed.