version_conflict
The version or revision you sent does not match the resource's current one, so your update was computed against state that is no longer there.
How to fix it
- Re-read the resource, re-apply your change to the version you just read, and send the new version number. Do not increment the number you were holding.
- Show the current state to whoever is editing before saving again. The message says to refresh and review, and for a sending policy that review is the point.
- If approving a draft returns this, its stored content no longer matches the approval. Ask the agent to send it again for a fresh approval.
- Treat a missing policy as version 0. An inbox with no inbox-scoped policy of its own is at version 0, not version 1.
Which rule fired
Updates to policies and webhook endpoints are optimistically concurrent: you send the version you read, and the write only proceeds if it still matches under a row lock. This is not a general-purpose staleness warning, it is targeted at the settings whose silent overwrite would be dangerous. A policy edit that clobbers a block rule someone added a minute ago would quietly widen who an agent can email. The approval path uses the same idea with a content hash instead of a counter: a draft whose payload hash no longer matches the one the approval was granted against cannot be released under that approval.
| In error.message | Means |
|---|---|
These settings changed. Refresh and review the current policy before saving. | expected_version on an inbox policy update does not equal the inbox-scoped policy's current version, where an absent policy counts as version 0. |
This endpoint changed. Refresh before changing it again. | expected_revision on a webhook control action does not equal the endpoint's current revision. |
Draft content changed. | Approving a draft whose stored payload hash no longer matches the hash recorded on the approval. |
Why it works this way: Binding an approval to a payload hash rather than to a draft id is the substantive choice here. It means approving a draft approves exactly that text: if the stored content ever differs from what was submitted, the approval no longer applies, which is what makes the human decision meaningful rather than a rubber stamp on a mutable object.
Example
{
"error": {
"code": "version_conflict",
"message": "These settings changed. Refresh and review the current policy before saving.",
"request_id": "req_8Kd2x91",
"retryable": false,
"details": {}
}
} Where it appears
-
PUT /projects/{project_id}/ inboxes/ {inbox_id}/ policy -
POST /projects/{project_id}/ webhooks/ {webhook_id}/ control -
POST /projects/{project_id}/ approvals/ {approval_id}/ approve
Paths are relative to https://api.emailforagents.ai/v1.