Skip to Content
APIEndpointsGenerate alignment suggestions

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/generate

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Body

application/json

FieldTypeRequiredDescription
languagestring, 1-10 charsoptionalDefaults to the brand’s prompt language, then en
country_codesstring[], up to 20optionalMarkets for the generated prompts
category_idsuuid[], up to 20optionalTarget 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 --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

{ "data": { "request_id": "7f3ab21c-9e4d-4b8a-8f1a-2c9d6e4b7a30", "mode": "category_targeted" }, "request_id": "req_5b0e77d213a94f6a8ce1" }

Response fields

FieldTypeDescription
data.request_iduuidrequired. NOT the same as the envelope’s own request_id. Use this one with List alignment suggestions’ request_id filter
data.modestringrequired. Resolved server-side, one of first_fill, category_targeted, general — see Notes
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestUnknown field, or this brand’s profile has neither a short description nor an industry set
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
403insufficient_scopeThe key does not carry write:alignment
403plan_requiredThis workspace is not enabled for API writes
403plan_requiredBrand alignment is not included in this workspace’s current plan
404not_foundThe brand does not exist, or this key is not allowed to reach it
429rate_limitedOver 60 requests per minute
503service_unavailableYour 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 passed category_ids and 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.

Last updated on