Restore Handbook Version
Restore a previous handbook version. This operation first snapshots the current content (so it can be recovered), then overwrites the handbook with the restored version's content.
Mutation
mutation RestoreHandbookVersion($handbookId: Int!, $versionId: Int!, $handbookType: String) {
restoreHandbookVersion(handbookId: $handbookId, versionId: $versionId, handbookType: $handbookType) {
success
restoredContent
restoredVersion {
id
handbookId
versionNumber
createdAt
}
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
handbookId | Int! | Yes | The handbook ID |
versionId | Int! | Yes | The version ID to restore |
handbookType | String | No | Handbook type. Defaults to "comprehensive" |
Response
{
"data": {
"restoreHandbookVersion": {
"success": true,
"restoredContent": "<html><head><title>Employee Handbook</title></head><body>...</body></html>",
"restoredVersion": {
"id": 42,
"handbookId": 123,
"versionNumber": 3,
"createdAt": "2025-03-10T08:00:00Z"
}
}
}
}
Examples
Restore a Version
mutation {
restoreHandbookVersion(handbookId: 123, versionId: 42) {
success
restoredVersion {
versionNumber
}
}
}
With Variables
mutation Restore($handbookId: Int!, $versionId: Int!) {
restoreHandbookVersion(handbookId: $handbookId, versionId: $versionId) {
success
restoredContent
restoredVersion {
id
versionNumber
createdAt
}
}
}
Variables:
{
"handbookId": 123,
"versionId": 42
}
Response Fields
RestoreHandbookVersionResponse
| Field | Type | Description |
|---|---|---|
success | Boolean! | Whether the restore operation succeeded |
restoredContent | String! | The restored HTML content now active on the handbook |
restoredVersion | HandbookVersionDetail | The version that was restored |
Error Responses
Version Not Found
{
"errors": [
{
"message": "Version not found"
}
]
}
Access Denied
{
"errors": [
{
"message": "Handbook not found or access denied"
}
]
}
Notes
- Requires bearer token authentication
- User can only restore versions for handbooks belonging to their account
- The current content is automatically saved as a new version before being overwritten, so you can always undo a restore
- The restored version is removed from the version list (it becomes the current content)
- You cannot restore
versionId: -1(that is already the current version)