Skip to main content

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

ParameterTypeRequiredDescription
inputHandbookRequest!YesHandbook generation input data
formatHandbookFormatNoOutput format: HTML (default), DOCX, or TXT
subscriptionTypeSubscriptionType!YesClassify 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:

FieldTypeRequiredDescription
companyNameString!YesCompany name
myStateStateList!YesPrimary state of operation
numberOfEmployeesInt!YesNumber of employees
multiStateBoolean!YesWhether company operates in multiple states
multiStateSelectedStates[StateList!]ConditionalRequired 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 appendixConditions field is optional - you can omit it entirely if you don't need city-specific content
  • Only include entries in appendixConditions where answer is true
  • 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

FieldTypeDescription
contentString!The handbook content (HTML, base64-encoded DOCX, or plain text)
contentTypeStringThe MIME type for the content
subscriptionTypeSubscriptionTypeThe subscription type: SUBSCRIPTION or ONE_TIME

Format Options

FormatDescriptionContent Type
HTMLHTML content as string (default)text/html
DOCXBase64-encoded DOCX fileapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
TXTPlain text (HTML tags stripped)text/plain

Notes

  • Requires bearer token authentication
  • All optional fields in HandbookRequest will 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