Skip to main content

Generate Handbook

Generate an employee handbook as reseller (requires reseller API key). Allows resellers to generate handbooks on behalf of users. Either email or userId (external_user_id) must be provided to identify the customer.

Mutation

mutation GenerateHandbook(
$email: String
$userId: String
$input: HandbookRequest!
$format: HandbookFormat
$subscriptionType: SubscriptionType!
) {
generateHandbook(
email: $email
userId: $userId
input: $input
format: $format
subscriptionType: $subscriptionType
) {
content
contentType
subscriptionType
}
}

Parameters

ParameterTypeRequiredDescription
emailStringConditionalCustomer's email address (alternative to userId)
userIdStringConditionalCustomer's external user ID from the reseller system (alternative to email)
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

Note: Either email OR userId must be provided (but not both).

Response

Same as customer generateHandbook - returns content, contentType, and subscriptionType based on the format specified.

{
"data": {
"generateHandbook": {
"content": "<html>...</html>",
"contentType": "text/html",
"subscriptionType": "SUBSCRIPTION"
}
}
}

Examples

Using Email

mutation {
generateHandbook(
email: "[email protected]"
input: {
companyName: "Acme Corporation"
myState: CA
numberOfEmployees: 50
multiState: false
multiStateSelectedStates: []
industry: PROFESSIONAL
}
subscriptionType: SUBSCRIPTION
) {
content
contentType
subscriptionType
}
}

Using User ID

mutation {
generateHandbook(
userId: "external_user_123"
input: {
companyName: "Acme Corporation"
myState: CA
numberOfEmployees: 50
multiState: false
multiStateSelectedStates: []
}
format: DOCX
subscriptionType: ONE_TIME
) {
content
contentType
subscriptionType
}
}

With Variables

mutation GenerateHandbook(
$userId: String
$input: HandbookRequest!
$format: HandbookFormat
$subscriptionType: SubscriptionType!
) {
generateHandbook(
userId: $userId
input: $input
format: $format
subscriptionType: $subscriptionType
) {
content
contentType
subscriptionType
}
}

Variables:

{
"userId": "external_user_123",
"input": {
"companyName": "Acme Corporation",
"myState": "CA",
"numberOfEmployees": 50,
"multiState": false,
"multiStateSelectedStates": []
},
"format": "HTML",
"subscriptionType": "SUBSCRIPTION"
}

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(
email: "[email protected]"
input: {
companyName: "Tech Startup Inc"
myState: CA
numberOfEmployees: 75
multiState: true
multiStateSelectedStates: [CA, NY, WA]
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: SEATTLE_WA, 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

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

Error Responses

Customer Not Found

{
"errors": [
{
"message": "Customer not found with email: [email protected]",
"extensions": {
"code": "NOT_FOUND"
}
}
]
}

Invalid Customer

{
"errors": [
{
"message": "Customer not found or access denied",
"extensions": {
"code": "FORBIDDEN"
}
}
]
}

Notes

  • Requires reseller API key authentication
  • Either email or userId must be provided to identify the customer
  • The customer must belong to the authenticated reseller
  • 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