Skip to main content

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

ParameterTypeRequiredDescription
inputCustomerInput!YesCustomer information including email, name, and external user ID

CustomerInput

FieldTypeRequiredDescription
emailString!YesEmail address for the customer. Must be a valid email format.
nameString!YesFull name of the customer.
userIdString!YesExternal user ID from the reseller system. Must be unique per reseller.
handbookLimitIntNoPer-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

FieldTypeDescription
userIdString!External user ID from the reseller system
emailString!Email address of the customer
nameStringFull name of the customer
createdAtString!ISO 8601 timestamp of when the customer was created
customerHandbookLimitIntPer-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 userId is 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 handbookLimit is not provided or is null, the customer will use the reseller's global default limit
  • The customer is automatically associated with the authenticated reseller