Skip to main content

Create Handbook Version

Create a version snapshot of the current handbook content. This saves the current content as a new version entry, allowing you to restore it later if needed.

Mutation

mutation CreateHandbookVersion($handbookId: Int!, $handbookType: String) {
createHandbookVersion(handbookId: $handbookId, handbookType: $handbookType) {
id
handbookId
handbookType
content
createdAt
versionNumber
user {
id
name
email
}
}
}

Parameters

ParameterTypeRequiredDescription
handbookIdInt!YesThe handbook ID to snapshot
handbookTypeStringNoHandbook type. Defaults to "comprehensive"

Response

{
"data": {
"createHandbookVersion": {
"id": 43,
"handbookId": 123,
"handbookType": "comprehensive",
"content": "<html><head><title>Employee Handbook</title></head><body>...</body></html>",
"createdAt": "2025-03-15T10:30:00Z",
"versionNumber": 4,
"user": {
"id": "abc-123",
"name": "John Doe",
"email": "[email protected]"
}
}
}
}

Examples

Basic Usage

mutation {
createHandbookVersion(handbookId: 123) {
id
versionNumber
createdAt
}
}

With Variables

mutation CreateVersion($handbookId: Int!) {
createHandbookVersion(handbookId: $handbookId) {
id
versionNumber
createdAt
}
}

Variables:

{
"handbookId": 123
}

Error Responses

Handbook Not Found

{
"errors": [
{
"message": "Handbook not found or access denied"
}
]
}

No Content

{
"errors": [
{
"message": "No handbook content found"
}
]
}

Notes

  • Requires bearer token authentication
  • User can only create versions for handbooks belonging to their account
  • Creates a snapshot of the current handbook content
  • Call this before making edits if you want to preserve the ability to roll back
  • Version numbers are sequential and automatically assigned
  • There is a maximum of 1000 versions per handbook