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
| Parameter | Type | Required | Description |
|---|---|---|---|
email | String | Conditional | Customer's email address (alternative to userId) |
userId | String | Conditional | Customer's external user ID from the reseller system (alternative to email) |
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 |
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
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
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 |
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
emailoruserIdmust be provided to identify the customer - The customer must belong to the authenticated reseller
- 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