SnozeDevelopers
API referenceAgent

Undo what the assistant changed

Reverts the changes a selector names, newest first, by applying each one's inverse through the ordinary write it would take by hand, so permissions, validation and the workspace ledger apply as for any edit; the writes are the caller's and are tagged with the returned `revertId`. One conflict refuses the whole revert (`blocked`, nothing changes) unless `skipConflicts` is true, which leaves the conflicting changes as they are. Changes already reverted are left alone, so repeating a revert is a no-op that reports them as reverted. Reverting with the selector `{ revertId }` undoes that revert (redo). Send an `Idempotency-Key` header to make a retried request replay its first result. Requires a Clerk session for a workspace member with the `ai:write` permission, plus the permissions each underlying write needs.

POST
/v1/workspaces/{workspaceId}/agent/edits/revert

Authorization

apiKey
headerAuthorizationBearer <snoze_sk_…>

Workspace API key created in Workspace settings → API keys. Scopes on the key bound what it can read and write.

Path Parameters

workspaceId*string

Request Body

application/json
  1. body
selector*||
skipConflicts?boolean|null

Response Body

Success

application/json
  1. response
data*
Example Request
curl -X POST 'https://api.snoze.dev/v1/workspaces/string/agent/edits/revert' \  -H 'Content-Type: application/json' \  -d '{  "selector": {    "chatId": "string"  }}'
Example Response
{  "data": {    "revertId": "string",    "status": "reverted",    "applied": 0,    "calls": [      {        "toolCallId": "string",        "operation": "string",        "chatId": "string",        "messageId": "string",        "jobId": "string",        "at": "string",        "changes": [          {            "id": "string",            "subject": {              "kind": "record",              "id": "string",              "databaseId": "string",              "label": "string"            },            "action": "created",            "state": "revertible",            "fields": [              "string"            ],            "reason": "string",            "conflict": {              "by": "string",              "at": "string",              "fields": [                "string"              ]            },            "at": "string"          }        ]      }    ],    "counts": {      "total": 0,      "revertible": 0,      "conflict": 0,      "reverted": 0,      "unsupported": 0,      "failed": 0    },    "truncated": true  }}