Make many feedback changes at once, previewed first, saved as one change that one undo reverses
For sorting feedback: an ordered list of the single changes (update_insight, move_insight, rename_topic, merge_topic), each step one object with op set to that tool's name and that tool's inputs, its insight or topic id included. Each step runs exactly as its tool would, on the feedback as the earlier steps left it, with the same rules: only insights linked to a feature (or New opportunity) of processed records can move; a topic merges only into another under the same feature, or both under New opportunity; a moved insight leaves its topic and the AI groups it at its new place after the save (so a later step does not find it in a topic there), unless the step moves it into a chosen topic. A topic can't move as a whole: move its insights, one step each; a topic of more than 50 insights takes several bulk changes, each with its own undo.
Work in two calls. Find the ids with search, list_feature_topics, list_topic_insights or list_source_records, keeping the read's meta.feedbackVersion, and send the steps with dryRun: true and that version as expectedVersion: nothing is saved, and the answer lists what each step would change (changes, each edited field with its value before; the value after is the one the step sends), steps that would change nothing and are skipped (skipped: a move to where the insight already is, the type, sentiment or name it already has), every step that would be refused with the reason and rule (problems), and each topic the steps name as it would be after them (topics: name, feature, how many insights it shows, the topic it was merged into). Show the person the outcome. Then send the same steps without dryRun: every step is saved or none. The first refused step stops it, nothing is saved, and the answer is that step's refusal, its message starting "Step : " and details.step naming it. A save answers the one feedback change it stored, listing every step, and the feedback's new version; when every step was skipped nothing is stored and change is null. The save checks every step again: background work (grouping, linking, new feedback) does not change the version, so topic counts and the AI's topics may differ from the preview by then. One undo_feedback_change on that change reverses all of it; it can't be redone.
At most 50 steps per request: split larger work into several bulk changes. expectedVersion refuses the call (conflict) when anyone stored a feedback change since you read it; read again, check the plan and send the new version. A retry is safe: sending the same save again (after a lost answer) answers the first result and changes nothing, while it is the product's newest feedback change, it is yours and it is not undone; after someone else's change it is a new save, where moves and edits already made are skipped and merges already made are refused as not found. Product Owners and Admins only; Viewers are refused, also for a preview.
AuthorizationBearer <token>An OAuth access token for the person who allowed your tool: register a client, then the authorization code flow with PKCE (S256). Send it as Authorization: Bearer <token> on every route that needs a signed-in person. Calls with a token are limited per person, across all their apps, to 120 calls a minute and 10,000 a UTC day; calls that start AI runs or knowledge base reads (creating an organization, starting a knowledge base read, rebuilding categories, retrying topics or rechecking) also to 10 a minute and 200 a UTC day. Over a limit a call answers 429 rate_limited with Retry-After and details.retryAfter in seconds, and changes nothing.
productId*stringA Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 validation_error.
uuidapplication/json- body
An ordered list of feedback changes, previewed with dryRun or saved as one change.
steps*array<|||>The changes to make, in order, 1 to 50. Each is one object: op names the kind of change and the other fields are its inputs, its insight or topic id included.
1 <= items <= 50dryRun?booleantrue: save nothing and answer the outcome (changes, skipped and refused steps, the topics touched).
expectedVersion?stringThe meta.feedbackVersion from the read you planned from (or a dry run's version); refused when the feedback changed since.
The preview, or the saved change
application/json- response
data*meta*curl -X POST 'https://staging.heuristic.app/v1/products/497f6eca-6276-4993-bfeb-53cbbbba6f08/feedback-changes/bulk' \ -H 'Authorization: Bearer <access token>' \ -H 'Content-Type: application/json' \ -d '{ "steps": [ { "op": "update_insight", "insightId": "e0b109ff-077c-4d58-916e-b128cab16ecb" } ]}'{ "data": { "dryRun": true, "version": "string", "change": { "id": "string", "kind": "edit", "subject": { "type": "insight", "id": "string", "label": "string" }, "details": { "fields": [ { "field": "type", "before": "string", "after": "string" } ], "from": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "to": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "into": { "id": "string", "name": "string", "insights": 0 }, "stepCount": 0, "steps": [ { "step": 0, "kind": "edit", "subject": { "type": "insight", "id": "string", "label": "string" }, "details": { "fields": [ { "field": "type", "before": "string", "after": "string" } ], "from": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "to": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "into": { "id": "string", "name": "string", "insights": 0 } } } ] }, "undoesChangeId": "string", "undoneAt": "string", "createdAt": "string", "createdBy": { "id": "string", "name": "string" }, "via": "web", "app": { "clientId": "string", "name": "string" } }, "changes": [ { "step": 0, "kind": "edit", "subject": { "type": "insight", "id": "string", "label": "string" }, "details": { "fields": [ { "field": "type", "before": "string", "after": "string" } ], "from": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "to": { "feature": { "id": "string", "title": "string" }, "topic": { "id": "string", "name": "string" } }, "into": { "id": "string", "name": "string", "insights": 0 } } } ], "skipped": [ { "step": 0, "reason": "string" } ], "problems": [ { "step": 0, "code": "string", "message": "string", "details": { "property1": null, "property2": null } } ], "topics": [ { "id": "string", "name": "string", "feature": { "id": "string", "title": "string" }, "insights": 0, "mergedIntoId": "string" } ] }, "meta": { "property1": null, "property2": null }}