Generate Handbook
Generate an employee handbook as a customer. Supports multiple output formats: HTML (default), DOCX, or TXT. Can be embedded in a website or app and is safe to use from frontend with bearer token authentication.
Mutation
mutation GenerateHandbook(
$input: HandbookRequest!
$format: HandbookFormat
$subscriptionType: SubscriptionType!
) {
generateHandbook(
input: $input
format: $format
subscriptionType: $subscriptionType
) {
content
contentType
subscriptionType
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | HandbookRequest! | Yes | Handbook generation input data |
format | HandbookFormat | No | Output format: HTML (default), DOCX, or TXT |
subscriptionType | SubscriptionType! | Yes | Classify whether this purchase is a subscription or one-time: SUBSCRIPTION or ONE_TIME |
Response
HTML Format (Default)
{
"data": {
"generateHandbook": {
"content": "<html><head><title>Employee Handbook</title></head><body>...</body></html>",
"contentType": "text/html",
"subscriptionType": "ONE_TIME"
}
}
}
DOCX Format
{
"data": {
"generateHandbook": {
"content": "UEsDBBQAAAAIAF...base64-encoded-content...",
"contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"subscriptionType": "SUBSCRIPTION"
}
}
}
TXT Format
{
"data": {
"generateHandbook": {
"content": "EMPLOYEE HANDBOOK\n\nAcme Corporation\n\nTable of Contents\n...",
"contentType": "text/plain",
"subscriptionType": "ONE_TIME"
}
}
}
Required Input Fields
The HandbookRequest input requires these fields:
| Field | Type | Required | Description |
|---|---|---|---|
companyName | String! | Yes | Company name |
myState | StateList! | Yes | Primary state of operation |
numberOfEmployees | Int! | Yes | Number of employees |
multiState | Boolean! | Yes | Whether company operates in multiple states |
multiStateSelectedStates | [StateList!] | Conditional | Required when multiState is true |
Examples
Basic Single-State Handbook
mutation {
generateHandbook(
input: {
companyName: "Acme Corporation"
myState: CA
numberOfEmployees: 50
multiState: false
multiStateSelectedStates: []
industry: PROFESSIONAL
fullTimeHours: 40
payPeriodFrequency: WEEKLY
trialPeriod: true
trialPeriodDays: 90
paidHolidays: true
vacationBenefits: true
sickLeave: true
healthInsurance: true
directDeposit: true
}
subscriptionType: ONE_TIME
) {
content
contentType
subscriptionType
}
}
Multi-State Handbook
mutation {
generateHandbook(
input: {
companyName: "Multi-State Corp"
myState: CA
numberOfEmployees: 100
multiState: true
multiStateSelectedStates: [CA, NY, TX, FL]
industry: PROFESSIONAL
fullTimeHours: 40
payPeriodFrequency: EVERY_TWO_WEEKS
trialPeriod: true
trialPeriodDays: 90
paidHolidays: true
paidHolidayNames: "New Year's Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, Christmas"
vacationBenefits: true
vacationBenefitEligibleMonths: 1
vacationBenefitType: ACCRUED_PTO
vacationHoursEarned: 40
vacationBenefitCarryover: true
sickLeave: true
sickHoursEarned: 24
maximumSickLeave: 80
healthInsurance: true
healthInsurancePlans: ["Basic PPO", "Premium HMO"]
directDeposit: true
companyVehiclesPolicy: true
socialMediaPolicy: true
progressiveDisciplinePolicy: true
}
subscriptionType: SUBSCRIPTION
) {
content
contentType
subscriptionType
}
}
Handbook with City-Specific Content (Appendix Conditions)
Optional: When your company has employees in specific cities that have unique labor law requirements, you can optionally use appendixConditions to include city-specific content:
mutation {
generateHandbook(
input: {
companyName: "Tech Startup Inc"
myState: CA
numberOfEmployees: 75
multiState: true
multiStateSelectedStates: [CA, NY]
industry: PROFESSIONAL
# Include city-specific content for locations where you have employees
appendixConditions: [
{ question: BERKELEY_CA, answer: true }
{ question: SAN_FRANCISCO_CA, answer: true }
{ question: LOS_ANGELES_CA, answer: true }
{ question: NEW_YORK_CITY_NY, answer: true }
{ question: OAKLAND_CA, answer: false }
]
fullTimeHours: 40
payPeriodFrequency: EVERY_TWO_WEEKS
vacationBenefits: true
sickLeave: true
healthInsurance: true
}
subscriptionType: SUBSCRIPTION
) {
content
contentType
subscriptionType
}
}
Notes:
- The
appendixConditionsfield is optional - you can omit it entirely if you don't need city-specific content - Only include entries in
appendixConditionswhereansweristrue - This tells the system to include city-specific compliance content for those locations
- See AppendixConditionQuestion enum for all available questions
Generate DOCX File
mutation {
generateHandbook(
input: {
companyName: "Acme Corporation"
myState: CA
numberOfEmployees: 50
multiState: false
multiStateSelectedStates: []
}
format: DOCX
subscriptionType: ONE_TIME
) {
content
contentType
subscriptionType
}
}
Handling DOCX Response
The content field will be a base64-encoded string. Decode it to get the DOCX file:
// JavaScript example
const response = await fetch('https://handbooks.io/api/graphql-public', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_bearer_token_here',
},
body: JSON.stringify({
query: `
mutation($input: HandbookRequest!, $format: HandbookFormat, $subscriptionType: SubscriptionType!) {
generateHandbook(input: $input, format: $format, subscriptionType: $subscriptionType) {
content
contentType
subscriptionType
}
}
`,
variables: {
input: {
companyName: "Acme Corporation",
myState: "CA",
numberOfEmployees: 50,
multiState: false,
multiStateSelectedStates: [],
},
format: "DOCX",
subscriptionType: "ONE_TIME",
},
}),
});
const { data } = await response.json();
const base64Content = data.generateHandbook.content;
// Decode base64 to binary
const binaryString = atob(base64Content);
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
// Create blob and download
const blob = new Blob([bytes], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'handbook.docx';
a.click();
Response Fields
| Field | Type | Description |
|---|---|---|
content | String! | The handbook content (HTML, base64-encoded DOCX, or plain text) |
contentType | String | The MIME type for the content |
subscriptionType | SubscriptionType | The subscription type: SUBSCRIPTION or ONE_TIME |
Format Options
| Format | Description | Content Type |
|---|---|---|
HTML | HTML content as string (default) | text/html |
DOCX | Base64-encoded DOCX file | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
TXT | Plain text (HTML tags stripped) | text/plain |
Notes
- Requires bearer token authentication
- All optional fields in
HandbookRequestwill use sensible defaults if not provided - DOCX format returns base64-encoded content that must be decoded client-side
- The handbook is automatically saved to the database and can be retrieved later using
getHandbook - For detailed information about input types and fields, see Types & Schema