Create Customer
Create a new SSO user (customer) for the reseller. The userId in the input refers to the external user ID from the reseller system.
Mutation
mutation CreateHandbookCustomer($input: CustomerInput!) {
createHandbookCustomer(input: $input) {
userId
email
name
createdAt
customerHandbookLimit
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | CustomerInput! | Yes | Customer information including email, name, and external user ID |
CustomerInput
| Field | Type | Required | Description |
|---|---|---|---|
email | String! | Yes | Email address for the customer. Must be a valid email format. |
name | String! | Yes | Full name of the customer. |
userId | String! | Yes | External user ID from the reseller system. Must be unique per reseller. |
handbookLimit | Int | No | Per-user handbook generation limit override (optional, null means use reseller's global default). |
Response
{
"data": {
"createHandbookCustomer": {
"userId": "external_user_123",
"email": "[email protected]",
"name": "John Doe",
"createdAt": "2025-01-01T00:00:00Z",
"customerHandbookLimit": 10
}
}
}
Examples
Create Customer with Default Limit
mutation {
createHandbookCustomer(
input: {
email: "[email protected]"
name: "John Doe"
userId: "external_user_123"
}
) {
userId
email
name
createdAt
customerHandbookLimit
}
}
Create Customer with Custom Limit
mutation {
createHandbookCustomer(
input: {
email: "[email protected]"
name: "John Doe"
userId: "external_user_123"
handbookLimit: 10
}
) {
userId
email
name
customerHandbookLimit
}
}
With Variables
mutation CreateCustomer($input: CustomerInput!) {
createHandbookCustomer(input: $input) {
userId
email
name
createdAt
customerHandbookLimit
}
}
Variables:
{
"input": {
"email": "[email protected]",
"name": "John Doe",
"userId": "external_user_123",
"handbookLimit": 10
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
userId | String! | External user ID from the reseller system |
email | String! | Email address of the customer |
name | String | Full name of the customer |
createdAt | String! | ISO 8601 timestamp of when the customer was created |
customerHandbookLimit | Int | Per-user handbook generation limit (null means use reseller's global default) |
Error Responses
Customer Already Exists
{
"errors": [
{
"message": "User with this userId already exists for this reseller",
"extensions": {
"code": "BAD_USER_INPUT"
}
}
]
}
Email Already Exists
{
"errors": [
{
"message": "User with this email already exists",
"extensions": {
"code": "BAD_USER_INPUT"
}
}
]
}
Invalid Email Format
{
"errors": [
{
"message": "Valid email is required",
"extensions": {
"code": "BAD_USER_INPUT"
}
}
]
}
Notes
- Requires reseller API key authentication
- The
userIdis the external identifier from your system, not the internal database ID - Email addresses must be unique across all resellers
- User IDs must be unique per reseller
- If
handbookLimitis not provided or isnull, the customer will use the reseller's global default limit - The customer is automatically associated with the authenticated reseller