Core
SDK Reference
Configuration, environments, and pagination
Setup
import { Commet } from '@commet/node'
const commet = new Commet({
apiKey: process.env.COMMET_API_KEY!,
})Get your API key from the dashboard.
Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your API key (starts with ck_) |
environment | 'sandbox' | 'production' | 'sandbox' | Target environment |
debug | boolean | false | Log requests/responses |
timeout | number | 30000 | Request timeout (ms) |
retries | number | 3 | Max retry attempts |
Environments
- Sandbox (
sandbox.commet.co) - Development, default - Production (
commet.co) - Live billing
commet.isSandbox() // true
commet.isProduction() // falseDebug Mode
See all requests and responses:
const commet = new Commet({
apiKey: process.env.COMMET_API_KEY!,
debug: true,
})
// [Commet SDK] POST https://sandbox.commet.co/api/customers
// [Commet SDK] Response status: 200 OKPagination
List endpoints use cursor-based pagination.
const page = await commet.customers.list({ limit: 25 })
if (page.hasMore) {
const nextPage = await commet.customers.list({
limit: 25,
cursor: page.nextCursor,
})
}| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 25 | Items per page (max 100) |
cursor | string | - | Cursor from previous response |
How is this guide?