Restore a deleted item
Platform module
POST/trash/restoretrashItems.restore
Restores a soft-deleted row within its retention period, as the caller (app.restore_trash_item): the table's own update rules decide. Rows that reference it and were deleted with it come back too. A row past retention answers 422 (trash_restore_expired), a live row 422 (trash_not_deleted). Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
- Requires the capability work.record.write.
- OAuth scopes: work.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.
Request body: RestoreRequest
| Field | Type | Required | Description |
|---|---|---|---|
| subject_urn | string | Yes | Constraints: length 1 to any |
{
"subject_urn": "urn:xpms:record:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
}Response 200: TrashRestoreResult
| Field | Type | Required | Description |
|---|---|---|---|
| subject_urn | string | Yes | URN of the restored row. |
| subject_table | string | Yes | Table of the restored row. |
| subject_id | string (uuid) | Yes | Identifier of the restored row. |
| rows_restored | integer | Yes | Rows restored: the row and the rows that reference it and were deleted with it.Constraints: range 1 to any |
{
"subject_urn": "urn:xpms:budgets:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"subject_table": "budgets",
"subject_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"rows_restored": 2
}Code samples
curl -X POST "$XOS_BASE_URL/trash/restore" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"subject_urn":"urn:xpms:record:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"}'const { data } = await xos.trashItems.restore({
"subject_urn": "urn:xpms:record:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
});response = xos.trash_items.restore({"subject_urn": "urn:xpms:record:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"})xos trash-items restore --data '{"subject_urn":"urn:xpms:record:0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"}'