Skip to main content

Replace Cost Category Keyword Aliases

PUT 

/api/cost-category-keyword-aliases

Replace the full set of keyword aliases for a single cost category. Idempotent — the repository diffs the supplied list against the existing rows: removes keywords not in the new list, inserts new ones. Default-flagged keywords (seeded by migration) are preserved if they remain in the new list, or removed if dropped. Keywords are normalized to lowercase + trimmed; duplicates are deduped server-side.

Request body:

FieldTypeRequiredNotes
cost_category_idintegeryesMust exist in cost_categories.
keywordsarrayyes (present)Each keyword: string, min 2 / max 100 chars. May be empty array to clear all keywords.

Response 200:

{
"data": {
"cost_category_id": 4,
"keywords": ["freight", "shipping", "fuel surcharge", "airfreight"]
},
"message": "Keyword aliases updated."
}

Response 422 (validation):

{
"message": "The cost category id field is required.",
"errors": {
"cost_category_id": ["The cost category id field is required."],
"keywords.0": ["Each keyword must be at least 2 characters."]
}
}

Request

Responses

Successful response