Kibo Customer API Developer Guide
Customer Dashboard
Manage customers in the Admin UI dashboard
Understanding Customer in Kibo
In Kibo, a “Customer” is more than just an email address; it’s a comprehensive entity representing a shopper’s identity, preferences, and history. Unlike some platforms that treat guests and registered users as entirely separate, Kibo builds a holistic view. A Customer Account (CustomerAccount) is the central hub that stores personal details, login credentials, address books (CustomerContact), and saved payment methods (Card).
This design allows for powerful personalization and streamlined experiences, like converting a guest shopper with an existing cart into a registered user without losing their data. Understanding the distinction between an anonymous shopper and a registered CustomerAccount is key to building effective customer-facing applications on the Kibo platform.
How This Domain Fits Into Kibo
The Customer domain is the foundation of the user experience. It directly connects to nearly every other part of the Kibo ecosystem:- Orders: Each order is linked to a
customerAccountIdto track purchase history. - Carts & Checkout: Customer accounts provide saved addresses and payment methods to accelerate the checkout process.
- Promotions: Customer data can be used for segmentation to offer targeted discounts and promotions.
- Returns: Customer accounts are used to manage and track return merchandise authorizations (RMAs).
Prerequisites
- Kibo API credentials and basic setup (Tenant ID, Site ID, Client ID, Shared Secret).
- Node.js 16+ with TypeScript.
- Familiarity with REST APIs and
async/awaitin JavaScript/TypeScript.
What You’ll Learn
After completing this guide, you’ll understand:- How Kibo structures Customer data and operations (based on official API specs).
- The key patterns Kibo uses across all Customer APIs (verified from apidocs.kibocommerce.com).
- Common workflows like creating accounts, managing addresses, and handling logins (with accurate, tested examples).
- How to avoid the most common beginner mistakes.
- How to read and navigate the official API documentation effectively for the Customer domain.
Kibo Customer Fundamentals
How Kibo Organizes Customer Data
Kibo’s Customer data is built around a few core objects that are linked together:CustomerAccount: The main object representing a registered user. It contains the user’sid,emailAddress,firstName,lastName, and login credentials.CustomerContact: Represents an address in the user’s address book. An account can have multiple contacts, each with types like ‘Shipping’ or ‘Billing’. This is a separate object from the main account.Card: A saved credit card or other payment method associated with the customer’s account. This data is securely stored and tokenized for PCI compliance.
Key Kibo Patterns You’ll See Everywhere
Before we write code, understand these patterns that appear in every Kibo API: Authentication Pattern: The Kibo SDK manages authentication for you. You create a singleConfiguration object containing your credentials (Client ID, Shared Secret, etc.). This object is then passed to the constructor of specific API clients (e.g., new CustomerAccountApi(configuration)). The clients will automatically handle the OAuth 2.0 token exchange behind the scenes for every API call.
Request/Response Structure:
Kibo API responses are generally consistent. A successful POST or PUT will return the created or updated object. A GET on a collection returns a paged object. For example, getting a customer account returns a clear structure:
try...catch block to handle these. The error contains a specific errorCode that you can use for programmatic handling.
Pagination and Filtering:
When fetching lists of customers, Kibo uses standard parameters like startIndex, pageSize, sortBy, and filter. The filter parameter uses a Kibo-specific syntax (e.g., filter='firstName eq "John"').
API Documentation Reference:
Throughout this guide, we’ll reference specific endpoints. Find complete specs at:
/api-overviews/openapi_customer_overview
Common Customer Workflows
Kibo developers typically work with Customers in these scenarios:- Account Registration: Creating a new customer account during a sign-up process.
- Account Management: Allowing a logged-in user to update their profile, add/edit addresses, or manage saved payments.
- Pre-flight Checks: Checking if an email address already exists before attempting to create a new account.
Creating a Customer Account: The Kibo Way
When You Need This
This is the most fundamental customer operation. You’ll use it for any “Sign Up” or “Create Account” feature in your storefront or application. The goal is to create a newCustomerAccount record in Kibo.
API Documentation Reference
- Endpoint:
POST /api/commerce/customer/accounts/ - Method:
POST - SDK Method:
addAccount - API Docs: Add Account
Understanding the Kibo Approach
Kibo treats account creation as a distinct, atomic operation. The request payload requires aCustomerAccountAndAuthInfo object, which includes both the account details (name, email) and the user’s new credentials (password). This ensures that an account is never created in an unusable state without a valid way to log in.
Code Structure Walkthrough
Before we implement, let’s understand what we’re building (based on actual API requirements):Step-by-Step Implementation
Step 1: Setting Up the Foundation First, we set up our configuration and import the necessary client from the Kibo SDK.payload object—it must match what the Kibo API expects.
What Just Happened? (Code Explanation)
- The setup phase created a single
Configurationobject. This is the source of truth for all API credentials and is passed to every client. - The API call was made using an instance of
CustomerAccountApi. The Kibo SDK provides this specialized client with type-safe methods likeaddAccountAndLoginthat match the API operations. - The payload was a
CustomerAccountAndAuthInfoobject. We explicitly separated theaccountdetails from thepassword, just as the API requires. - The response handling uses a
try...catchblock. On success, Kibo returns the newly createdCustomerAccountobject. On failure, we log the structured error, which includes a helpfulerrorCode.
Common Beginner Mistakes
Mistake 1: Sending only account details without the password wrapper.id or userId during creation.
These fields are read-only and assigned by Kibo upon successful creation. Including them in your request payload will cause a validation error.
Multiple Real-World Examples
Here are 5 complete, production-ready examples for commonCustomer operations.
Example 1: Check if a User Exists (Get Login State)
Before showing a registration form, it’s good practice to check if an email is already in use.- API Docs: Get Login State By Email Address
Example 2: Update a Customer’s Profile
This allows a user to change their first name, last name, or marketing preferences.- API Docs: Update Account
Example 3: Add a New Address to an Account
This is a key part of “My Account” functionality, allowing users to build an address book.- API Docs: Update Account Contact
Example 4: Add a Saved Credit Card
Securely save a tokenized payment card to a customer’s account for faster checkout.- API Docs: Add Account Card
Example 5: Create Account and Log In Simultaneously
This workflow is perfect for registrations that should immediately start a user session. It creates the account and returns an authentication ticket in one atomic API call.- API Docs: Create User Auth Ticket - Note: The SDK simplifies this into a single
performCustomerAuthcall. The true workflow is creating an account and then creating an auth ticket.
Integrating Customer with Other Kibo Domains
Customer + Orders Integration
TheCustomerAccount is the link to a user’s entire purchase history. When you retrieve an Order object, it will contain a customerAccountId field. You can use this ID to fetch the full customer profile.
Practical Example: On an order confirmation page, you could use the customerAccountId from the order to retrieve the customer’s firstName for a personalized “Thank You, John!” message.
Customer + Carts & Checkout Integration
When a logged-in user adds items to their cart, the cart is associated with theircustomerAccountId. This allows for persistent carts across devices. During checkout, you can use the accountId to fetch their address book (CustomerContact objects) and saved payment methods (Card objects) to pre-fill the checkout form, drastically improving conversion rates.
Troubleshooting Your Customer Implementation
Reading Kibo Error Messages
Kibo’s error responses are structured and predictable. The SDK client will throw an error object containing abody with these key fields:
DUPLICATE_EMAIL: Occurs when callingcreateAccountwith an email address that already exists.VALIDATION_ERROR: The request body is missing a required field or has an invalid data type. Theitemsarray in the error will specify which field failed.INVALID_CREDENTIALS: Occurs during login (createUserAuthTicket) when the username or password is incorrect.RESOURCE_NOT_FOUND: Trying to update or fetch a resource with an ID that doesn’t exist (e.g.,updateAccountwith an invalidaccountId).
Common Development Issues
Issue 1: Password complexity rules causingVALIDATION_ERROR on account creation.
- Why it happens: Every Kibo site has configurable password policies (minimum length, required characters, etc.). If the password in your
createAccountpayload doesn’t meet these rules, the API will reject it. - How to fix it: Ensure the password you send meets the site’s requirements. These are visible in the Kibo Admin under System > Settings > Password Policy.
- How to avoid it: Implement client-side validation on your registration form that matches the Kibo password policy.
- API Reference: Add Account (The error response will contain details in the
itemsarray).
- Why it happens: A common mistake is to add a
CustomerContactorCardand then fetch the mainCustomerAccountobject expecting the new data to be there. ThegetAccountendpoint does not always return a fully hydrated object with all contacts and cards by default. - How to fix it: After adding a contact or card, use the specific
getAccountContactorgetAccountCardmethods to verify it was created. Alternatively, use thegetAccountContactsorgetAccountCardsmethods to retrieve the full list. - API Reference: Get Account Contacts
Debugging Checklist
When your Customer implementation isn’t working:- Verify Endpoint: Does the SDK method you’re calling (
createAccount) correspond to the correct HTTP method and URL (POST /api/commerce/customer/accounts/) in the API docs? - Confirm Request Body:
console.logyour payload object right before you send it. Does its structure ({ account: { ... }, password: "..." }) exactly match the schema on apidocs.kibocommerce.com? - Check Authentication: Are
tenantId,siteId,clientId, andsharedSecretall correctly configured? An auth error usually results in a 401 Unauthorized status. - Validate IDs: If you are updating or fetching an entity (
updateAccount,addAccountContact), double-check that theaccountIdyou are using is valid and exists in the system. - Review API Response: In your
catchblock, log the entire error object (JSON.stringify(error, null, 2)). TheerrorCodeandmessagein thebodywill tell you exactly what went wrong. - Check for Site Policies: Are there any site settings (like password policies or account lockout rules) that could be affecting your API call?

