Read reader tags and update reader labels or extra data
Read or replace a reader’s labels, or store custom values on their publication relationship. For article categories, tags or authors, use content taxonomies.
| Task | Operation | Allowed credentials |
|---|---|---|
| Replace reader tag links, with effects across publications | POST /api/v1/admin/users/{user_id}/tags | admin or partner, or root |
| Read selected-publication and global tags | GET /api/v1/admin/users/{user_id}/tags | readonly, manager, support, admin or partner, or root |
| Merge top-level extra-data keys for one publication | PUT /api/v1/admin/users/{user_id}/extra | admin or partner, or root |
Existing context and identifiers
Use the API address, token and publication public key supplied by your operator. Send the key in resource. Service accounts cannot use these three routes, including those with full_access. Keep privileged calls in trusted server code.
| Input | Location / type | Meaning |
|---|---|---|
| resource | Required header, publication public-key string | Selects the publication context; not a numeric resource ID or secret. Its scope differs between the tag write, tag read and extra update below. |
| token | Required header, existing authorized token string | ADMIN_TOKEN in examples. readonly is inherited by manager/support/admin/partner. Writes start at admin, inherited by partner; root is permitted. support alone cannot perform either write. |
| user_id | Required digits-only path value | Global account ID, not a tag ID. Use a known intended reader. |
The caller must be active; their current publication relationship, when present, must not be locked or suspended. Confirm the intended reader from your audience records. Extra update requires that reader’s existing publication relationship. Review the cross-publication replacement effects before changing tags.
Example conventions
Examples use fictional reader 1002 and 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 existing RESOURCE_KEY and ADMIN_TOKEN. Diagnostics can add fields; see response conventions.
Replace a reader’s tag links
POST /api/v1/admin/users/{user_id}/tags
Replace a reader’s tag links with tags for the selected publication.
Replacement first attempts to remove all of the reader’s tag links across every publication, including global tags. The publication header does not limit removal. This is not append. Tag definitions can remain after their reader links are removed.
The tag read below shows only this publication’s and global tags. It cannot preserve other-publication tags or serve as a complete backup for replacement.
Before you call
Use an admin-or-inherited token, or root, and the reader ID. Review the wider removal against your existing records. The example assumes no tag links exist anywhere; the scoped GET cannot prove that. This route cannot preserve other-publication or global links through an isolated edit.
Request
Send a raw JSON string array, such as ["Newsletter","subscriber"], with Content-Type: application/json. Do not wrap it in tags.
| Body value | Type / requirement | Meaning and constraints |
|---|---|---|
| Each array element | Tag string, raw length 3–25 | Checked before normalization. Strings are trimmed and lowercased; URL-decoding also applies to stored/read slugs. No automatic hyphenation or punctuation stripping is promised. |
| Entire array | List of desired selected-publication tag strings | No list-size maximum is exposed here. No ordering or unique-count guarantee. Empty input is destructive, as described below. |
Use a raw array containing only tag strings. Validate each string’s raw length and its trimmed, lowercased value before sending it.
Validate the complete intended list before sending. Empty input can remove links without adding replacements. Malformed input or values that normalize to empty can remove existing links before replacement fails. Keep a complete record of the reader’s existing labels across publications before replacement.
Response
HTTP 200 returns these top-level fields:
| Field | Type / presence | Meaning |
|---|---|---|
| status | String, updated | Completion marker; not proof every deletion/insertion persisted. |
| tags | Array of slug strings | Current selected-publication or global-resource-0 tags, not all tags across publications. Empty means no tags in this selection. No tag IDs or ownership fields. |
A failure can occur after some links have changed. The scoped response does not verify all deletion or insertion effects across publications. Inspect the saved labels after an uncertain result before another replacement.
Example: Assign tags to a reader with no existing tags anywhere
Assume existing records establish that reader 1002 has no tags anywhere. The mixed-case request adds two selected-publication tags and shows normalization.
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/tags" \
-X POST \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '["Newsletter","subscriber"]'
const response = await fetch(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/tags`, {
method: "POST",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify(["Newsletter", "subscriber"])
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
body = json.dumps(['Newsletter', 'subscriber']).encode("utf-8")
request = Request(
os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/tags",
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:
{
"status": "updated",
"tags": [
"newsletter",
"subscriber"
]
}
An empty replacement can clear tag links everywhere
An intentionally empty list can remove links everywhere and return this nominal result:
{
"status": "updated",
"tags": []
}
The empty response does not confirm every deletion. After an uncertain result, inspect known reader state before repeating. Repetition removes links again; it does not restore them.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 404 | user_not_exists | The reader account was not found. | Check the reader ID against your intended audience records. |
| 409 | invalid_tags_format | An iterated tag value is an array/object. | Send a raw array of strings; remove the tags wrapper. |
| 409 | invalid_tag | Raw tag value fails presence/length validation. | Supply nonempty strings of raw length 3–25; also check normalized content before resubmission. |
| 200 | status updated with unexpected tags | The response shows only selected tags and may not confirm every replacement effect. | Compare with the intended reader state, including known other-publication/global links. Do not infer restoration or retry blindly. |
| Varies / no response | Other database, event or transport failure | Some changes can already have occurred; no uniform error or rollback is established. | Retain the request reference if available and ask the integration operator to inspect the outcome before another write. |
See shared errors. Read the scoped result, remembering that it cannot show all replacement effects.
Read the reader’s selected-publication and global tags
GET /api/v1/admin/users/{user_id}/tags
Read labels belonging to the selected publication or global resource 0. Other-publication and null-resource tag rows are excluded.
Before you call
Use a readonly-or-inherited Admin token, or root, with the publication key and the intended reader ID. An empty response does not mean the account has no tags elsewhere.
Request
Send the path and headers above, without a body. This read has no pagination, filter or sort options.
Response
| Field | Type / presence | Meaning |
|---|---|---|
| items | Array of tag-slug strings on HTTP 200 | Selected-publication and global-resource-0 reader labels. [] means no matching tags. No paginator, tag IDs, resource ownership, uniqueness or stable order is promised. |
These are reader labels, not content taxonomy, membership or access results. Other-publication tags are not included.
Example: Read labels for the selected publication
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/tags" \
-X GET \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}"
const response = await fetch(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/tags`, {
method: "GET",
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
request = Request(
os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/tags",
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="GET"
)
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:
{
"items": [
"newsletter",
"subscriber"
]
}
No tags match this selection
HTTP 200 response:
{
"items": []
}
The account exists but no tags match this publication/global-0 selection. Tags may exist elsewhere; this result cannot establish that broad replacement is safe.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 404 | user_not_exists | The reader account was not found. | Check the reader ID against your existing account records. |
| 200 | items [] | No matching tags in this publication/global-0 selection. | Display an empty label state; do not infer absence of other-publication tags. |
| Varies | Other query/response-format failure | No uniform operation-specific error is established. | Retain the request reference if available and ask the integration operator to inspect the failure. |
See shared errors for caller/context failures. Display these labels. A tag change requires the broader-removal decision above; do not automate a read-modify-write loop.
Update extra data on one reader/publication relationship
PUT /api/v1/admin/users/{user_id}/extra
Store values on an existing reader/publication relationship. Object input merges top-level keys. This older JSON extra map is separate from grouped extra-data rows.
Before you call
Use an admin-or-inherited token, or root. The reader/publication relationship must exist; the call does not create it or change global account extra. The example requires an object-shaped stored extra value. Incompatible shapes can fail.
Request
Send JSON with Content-Type: application/json and an extra property.
| Field | Type / requirement | Meaning and constraints |
|---|---|---|
| extra | Required non-null value; use a JSON object | Application-defined keys on the selected reader/publication relationship. Use object input for the key-merge behavior described here. |
| extra.<key> | Application-defined JSON value | For object input, replaces that entire top-level value; omitted top-level keys remain. Null stores a null property rather than deleting it. |
Object input replaces supplied nested values rather than merging them recursively; there is no merge flag. An empty object makes no assignments. A top-level key set to null stores null rather than deleting that key. A missing or null extra is rejected. For this task, send an object; non-object values do not provide a reliable clear operation.
Existing data shapes matter. Nonempty array input can merge subkeys or replace values differently and can fail when the stored shape is incompatible. Use an object and known object-shaped stored data for the documented merge behavior.
Response
| Field | Type / presence | Meaning |
|---|---|---|
| status | String, success on nominal HTTP 200 | Completion marker; inspect saved data before relying on a change after an uncertain result. |
| extra | Current in-memory relationship-extra value | Normally decoded after a successful save; the object-shaped example returns an object. An uncertain save can return a JSON-encoded string instead. Check both the returned type and the saved values. |
This stores relationship data. Keys do not themselves grant permissions, change credentials or confirm provider synchronization. The response does not guarantee all-or-nothing persistence.
Example: Retain an omitted key and replace a supplied nested value
Assume extra has locale: "en" and preferences containing theme: "light" and digest: true. Replacing preferences retains the omitted locale, but removes digest from the replaced nested value.
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/extra" \
-X PUT \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '{"extra":{"preferences":{"theme":"dark"}}}'
const response = await fetch(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/extra`, {
method: "PUT",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify({"extra": {"preferences": {"theme": "dark"}}})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
body = json.dumps({'extra': {'preferences': {'theme': 'dark'}}}).encode("utf-8")
request = Request(
os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/extra",
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 after a normal successful save:
{
"status": "success",
"extra": {
"locale": "en",
"preferences": {
"theme": "dark"
}
}
}
An empty extra object makes no assignments. A top-level key set to null keeps that key with a null value. Neither clears the map.
The reader has no relationship with this publication
HTTP 404 response:
{
"error": "user_resource_not_exists",
"error_description": "Incorrect user resource",
"req_guid": "example-request"
}
The global account may exist, but its relationship with the selected publication is required. Extra keys cannot create that relationship.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 404 | user_resource_not_exists | No matching reader/publication relationship. | Check the known reader ID and selected publication key against existing audience records. |
| 409 | extra_required | extra is missing or null. | Send an object containing a non-null extra object; an empty object makes no key changes. |
| 409 | user_resource_extra | The extra-data change failed during processing. | Check the supplied and stored data shapes with the integration operator; persistence may already have occurred before a later failure. |
| 200 | status success with unexpected extra value/type | Some input makes no changes, or the requested change was not saved. | Compare the intended keys with existing relationship data; do not treat success as durable-write proof. |
| Varies / no response | Other PHP/transport failure | Not every incompatible-shape or transport failure is converted into the documented 409. | Retain the request reference if available; inspect current state before another write. |
See shared errors for caller/context failures. To inspect this relationship’s flat extra value, use the Admin email lookup with the reader’s stored email and the same publication. Grouped extra-data rows are a separate store. The update acknowledgement alone does not confirm durable persistence.