Skip to Content
APIEndpointsCreate alignment category

Create alignment category

Creates a category to group alignment prompts and claims under, for example “Pricing” or “Support” — the same as the “Add Category” button on the Alignment Prompts page.

The slug is derived from the name and must be unique within the brand. You cannot set it directly.

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

POST /v1/brands/{brand_id}/alignment/categories

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Body

application/json

FieldTypeRequiredDescription
namestring, 1-100 charsrequiredIts derived slug must be unique in the brand
descriptionstring, up to 500 charsoptional

Request

curl --request POST \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/alignment/categories' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: 5b0e77d2-13a9-4f6a-8ce1-9a3f5e21c0aa' \ --header 'Content-Type: application/json' \ --data '{"name": "Pricing", "description": "Claims about cost, plans and billing."}'

Response

{ "data": { "category": { "id": "8f3d2c1b-6a94-4e57-9c02-1b7f4d3a8e65", "name": "Pricing", "slug": "pricing", "description": "Claims about cost, plans and billing.", "sort_order": 0, "is_system": false, "active_prompt_count": 0 } }, "request_id": "req_7d21b0af59c34e18b6ac" }

Response fields

FieldTypeDescription
data.category.iduuidrequired. Use it as a category_id filter, or with Update / Delete alignment category
data.category.namestringrequired
data.category.slugstringrequired. Derived from the name, unique per brand
data.category.descriptionstring | nullrequired
data.category.sort_orderintegerrequired
data.category.is_systembooleanrequired. Always false for a category created here
data.category.active_prompt_countintegerrequired. Always 0 — a category has no prompts assigned to it yet at creation
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestUnknown field, empty or over-100-character name, or description over 500 characters
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
404not_foundThe brand does not exist, or this key is not allowed to reach it
409conflictAnother category in this brand already has that name
429rate_limitedOver 60 requests per minute

Notes

Slugs are derived, not supplied. "Pricing" and "pricing" collide, and the second returns 409.

New categories are never is_system. That flag is reserved for a small set of categories seeded automatically; every category created here is false.

Assign prompts to it separately. This only creates the category. Use Create alignment prompt with category_id set, or Update alignment prompt to move an existing prompt into it.

Idempotency-Key is required. Reuse it when retrying an attempt and the original response is replayed rather than a second category being created. See Idempotency.

Last updated on