DashClient
Initialize the SDK client with your API key.
Updated
On this page
DashClient
The main entry point for the SDK. All modules are accessed as properties of the client instance. DashClient works for all organization types — e-commerce, service, and wholesale.
Constructor
import { DashClient } from "dash4devs"
const dash = new DashClient({
apiKey: "pk_live_...", // required
baseURL: "https://api.dashfordevs.com", // optional, auto-detected
})
Properties
| Property | Type | Description |
|---|---|---|
apiKey | string | The API key used for authentication |
baseURL | string | Backend API URL |
version | string | SDK version ("0.1.0") |
Core Methods
// Health check — verify API key and get org info
const info = await dash.ping()
// Get store-wide settings (name, logo, currency, etc.)
const data = await dash.getGlobalData()
// Get page data by path or name
const page = await dash.getPageData("/about")
// Session management
const sessionId = dash.getSessionId()
dash.setSessionId("custom-session-id")
Modules
Available modules depend on your organization type, but all modules are accessible through the SDK regardless — the API returns appropriate data for your org type.
Content & Frontend (All Org Types)
| Module | Access | Docs |
|---|---|---|
| Blog | dash.blog | dash.blog |
| Contact | dash.contact | dash.contact |
| Auth | dash.auth | dash.auth |
| SEO | dash.seo | dash.seo |
| Global Data | dash.getGlobalData() | dash.getGlobalData |
| Pages | dash.pages | Pages |
| Content Types | dash.contentTypes | Content Types |
| Media | dash.media | Media |
E-commerce & Wholesale
| Module | Access | Docs |
|---|---|---|
| Products | dash.products | dash.products |
| Categories | dash.categories | dash.categories |
| Cart | dash.cart | dash.cart |
| Checkout | dash.checkout | dash.checkout |
| Shipping | dash.shipping | dash.shipping |
| Locations | dash.locations | dash.locations |
| Discounts | dash.discountStore | dash.discounts |
Additional Modules
dash.payment, dash.tracking, dash.email, dash.marketing, dash.upload, dash.brands, dash.affiliates, dash.tax, dash.referrals, dash.earnPoints, dash.legal, dash.coa, dash.sitemap, dash.admin
TypeScript
The SDK ships with full TypeScript definitions. Import types directly:
import type { Product, CartItem, Category, Pagination } from "dash4devs"
ISR Revalidation Helper
import { createRevalidateHandler } from "dash4devs"
// app/api/revalidate/route.ts
export const POST = createRevalidateHandler({
secret: process.env.REVALIDATION_SECRET!,
})