Add, rename or delete a classification term
Add a term such as Culture to Categories, rename a shared term, or remove it from the publication. A term can belong to several groups. Renaming or deleting it affects every group that uses it.
| Task | Operation |
|---|---|
| Add a new term to Categories | POST /api/v1/admin/taxonomies/{key}/terms |
| Rename a shared term | PUT /api/v1/admin/terms/{key} |
| Delete a shared term | DELETE /api/v1/admin/terms/{key} |
Before you start
Allowed roles: support, admin, partner; root is also permitted. Send the assigned token and publication key. readonly/manager and service accounts cannot write; full_access does not enable these routes. Keep calls in trusted server code. Caller activation, session and current publication-relationship restrictions apply.
| Input | Location / type | Meaning |
|---|---|---|
| resource | Required header, publication public-key string | Selects the publication, not a numeric group or term ID. |
| token | Required header, existing eligible token string | ADMIN_TOKEN in examples. |
| key | POST path text | Existing parent taxonomy key, such as category. |
| key | POST body text; PUT/DELETE path text | Term key within the selected publication, such as culture. PUT's body contains its intended replacement key. |
Use intended stored keys, not numeric IDs. Lookup trims text and matches publication without lowercase/slug conversion. General encoded/slash-containing path support is not guaranteed.
A request can save data before failure, including after create commits. Update/delete have no encompassing transaction; a completed response does not confirm every save. Inspect configuration before repeating. These routes do not update reader memberships or providers, or confirm access/cache propagation.
Examples use fictional category/Categories and term 7201/culture/Culture in separate scenarios, with illustrative responses. Requests use cURL, Node.js 18+ fetch in an ES module (.mjs), and Python 3 urllib. Set WALLKIT_API_BASE to scheme and host only, plus RESOURCE_KEY and ADMIN_TOKEN. See shared errors.
Add a new term under Categories
POST /api/v1/admin/taxonomies/{key}/terms
Create a new term and link it to an existing group. Existing publication terms cannot be reused or attached here, even if not yet linked to this group. Other links and the group title remain.
Request
Send JSON with Content-Type: application/json for an existing taxonomy and unused publication term key. Filter, pagination and sort are ignored.
| Input | Location / type / requirement | Meaning and constraints |
|---|---|---|
| key | Path text; required | Parent taxonomy key, category in this example. |
| key | Body text; required | Intended new term key, sanitized and trimmed. |
| title | Body text; required | New term label, sanitized and trimmed. |
Supply both plain nonblank fields. Invalid/missing values can have different error shapes. Extra taxonomy IDs, term arrays and rules do not replace links.
Example: Add Culture to Categories
Assume category exists and culture is unused here. New term ID 7201 is illustrative.
curl "${WALLKIT_API_BASE}/api/v1/admin/taxonomies/category/terms" \
-X POST \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '{"key":"culture","title":"Culture"}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/taxonomies/category/terms`);
const response = await fetch(url, {
method: "POST",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify({"key": "culture", "title": "Culture"})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/taxonomies/category/terms"
body = json.dumps({'key': 'culture', 'title': 'Culture'}).encode("utf-8")
request = Request(
url,
data=body,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"], "Content-Type": "application/json"},
method="POST"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"id": 7201,
"key": "culture",
"title": "Culture"
}
Keep the returned term fields. The link ID is not returned. Success is 200, not 201.
Alternative: That publication term already exists
HTTP 404 response:
{
"error": "invalid_term_key",
"error_description": "Term key exists",
"req_guid": "synthetic-request-reference"
}
Changing the parent does not turn create into attach-existing. Inspect the existing term and group; this is not upsert.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 406 | incorrect_data / Body must be json format | Missing JSON or a value treated as empty by the API. | Send the intended JSON object. |
| 404 | taxonomy_not_exists / Taxonomy not found | No parent group matches key/publication. | Check the taxonomy key and publication; do not pass the term key as parent. |
| 404 | invalid_term_key / Term key exists | Key already identifies a term in the publication. | Inspect the existing record; this call cannot reuse it. |
| 409 | invalid_key or invalid_title / validation message | Required body field fails validation. | Supply both intended plain fields. |
| 409 / varies | create_term_fail / Create term fail, or other unnormalized failure | Term/link/save/refresh or another failure, potentially after a write. | Keep diagnostics and inspect stored term/group links before retrying. |
Read Categories for selected terms; the term response does not list its groups.
Rename a shared term
PUT /api/v1/admin/terms/{key}
Change the shared term’s key/title across all its groups. This does not rebuild links or rename groups. Update consumers of the old key.
A rename requires a new key. Keeping the current key for a title edit matches the term itself and returns HTTP 404 invalid_term_key / New term key exists.
Request
Send JSON with Content-Type: application/json and both body fields. Omission/null does not preserve them. Filter, pagination and sort are ignored.
| Input | Location / type / requirement | Meaning and constraints |
|---|---|---|
| key | Path text; required | Existing term key, culture in the example. |
| key | Body text; required | Intended replacement key unused in this publication, sanitized and trimmed. |
| title | Body text; required | Intended shared term title, sanitized and trimmed. |
Supply intended nonblank key and title strings and inspect their saved values. Extra group, term, content or Plan arrays do not replace links.
Example: Deliberately rename Culture to Arts and culture
Assume term 7201/culture exists and arts-and-culture is unused here. Categories stays; the shared term changes.
curl "${WALLKIT_API_BASE}/api/v1/admin/terms/culture" \
-X PUT \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '{"key":"arts-and-culture","title":"Arts and culture"}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/terms/culture`);
const response = await fetch(url, {
method: "PUT",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify({"key": "arts-and-culture", "title": "Arts and culture"})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/terms/culture"
body = json.dumps({'key': 'arts-and-culture', 'title': 'Arts and culture'}).encode("utf-8")
request = Request(
url,
data=body,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"], "Content-Type": "application/json"},
method="PUT"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"id": 7201,
"key": "arts-and-culture",
"title": "Arts and culture"
}
The same term ID identifies the renamed record, not a new record or link.
Alternative: A same-key title edit collides
Keeping body key culture for a title edit collides with the current record. Illustrative HTTP 404:
{
"error": "invalid_term_key",
"error_description": "New term key exists",
"req_guid": "synthetic-request-reference"
}
Another term using the proposed key gives the same error. It does not mean the term is missing.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 404 | invalid_term_key / Term key empty or Term key not exists | Empty/falsy path, including string 0, or no matching term after lookup. | Check the known stored term key and publication. |
| 406 | incorrect_data / Body must be json format | Missing JSON or a value treated as empty by the API. | Send both intended body fields as JSON. |
| 409 | invalid_key or invalid_title / validation message | Required field fails validation. | Supply both intended replacement key and title. |
| 404 | invalid_term_key / New term key exists | Proposed key matches this or another publication term. | For a deliberate rename, confirm the intended unused key. A same-key title edit is not supported by this path. |
| 409 / varies | update_term_fail / Update term fail, or other unnormalized failure | Save/response or another failure after possible writes. | Inspect the record under its intended old/new key before retrying. |
Read the renamed term with arts-and-culture. External reference migration and access propagation are separate.
Delete a shared term
DELETE /api/v1/admin/terms/{key}
Delete the shared term across its groups. Review every use first. Database constraints may also remove content/Plan/event links. The response is a fixed acknowledgement, not verified cleanup.
Request
Send the stored term key and headers. Body, parent-group selector, filter, pagination and sort are ignored. This is not unlink-one-group.
Example: Delete an intentionally disposable renamed term
Assume arts-and-culture exists in this independent deletion scenario.
curl "${WALLKIT_API_BASE}/api/v1/admin/terms/arts-and-culture" \
-X DELETE \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/terms/arts-and-culture`);
const response = await fetch(url, {
method: "DELETE",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/terms/arts-and-culture"
request = Request(
url,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="DELETE"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"result": true
}
| Field | Type / presence | Meaning |
|---|---|---|
| result | Literal boolean true if the response is reached | Fixed reply after the delete attempt. Inspect the stored term and affected mappings to confirm removal; this marker is not a per-record cleanup result. |
Alternative: The term is missing
HTTP 404 response:
{
"error": "invalid_term_key",
"error_description": "Term key not exists",
"req_guid": "synthetic-request-reference"
}
A repeated delete can return this error rather than success.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 404 | invalid_term_key / Term key empty or Term key not exists | Falsy path, including string 0, or no key/publication match. | Check the intended term key and inspect known configuration. |
| 200 | result:true | Fixed response after the delete attempt. | Inspect the stored term and affected mappings; do not treat it as a cleanup audit. |
| Varies / no guaranteed JSON | Constraint/query/runtime/routing/transport failure | Errors can use different response formats, and earlier changes may remain. | Retain diagnostics and inspect persisted state before retrying; no unchanged-state, safe-retry or complete-cascade promise. |
Read affected groups for selected terms. This cannot verify every dependent mapping, cache or access result.
Read the create/update result
Both writes return HTTP 200 with term fields at the top level, apart from optional diagnostics. No parent group, link ID, terms or items/paginator wrapper is added.
| Field | Type / presence | Meaning |
|---|---|---|
| id | Numeric model identifier; selected, no explicit output cast | Term record ID, distinct from its key and taxonomy/junction IDs. |
| key | Text; selected | Term key. POST's refreshed record can reflect URL-decoded stored text; do not assume identical decoding for PUT or a universal stored-key round trip. |
| title | Text; selected | Shared term label; POST fetch decoding and PUT assignment differ. No universal null-coercion guarantee. |
This includes id, unlike the standalone key/title list. It adds no Plan rules or reader-access decision. Examples use plain keys and labels.