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/categoriesAuthorization
| 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 |
|---|---|---|---|
name | string, 1-100 chars | required | Its derived slug must be unique in the brand |
description | string, up to 500 chars | optional |
Request
cURL
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
200
{
"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
| Field | Type | Description |
|---|---|---|
data.category.id | uuid | required. Use it as a category_id filter, or with Update / Delete alignment category |
data.category.name | string | required |
data.category.slug | string | required. Derived from the name, unique per brand |
data.category.description | string | null | required |
data.category.sort_order | integer | required |
data.category.is_system | boolean | required. Always false for a category created here |
data.category.active_prompt_count | integer | required. Always 0 — a category has no prompts assigned to it yet at creation |
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, empty or over-100-character name, or description over 500 characters |
| 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 |
| 404 | not_found | The brand does not exist, or this key is not allowed to reach it |
| 409 | conflict | Another category in this brand already has that name |
| 429 | rate_limited | Over 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.