Commet
  • Pricing
Log InTry out
Introduction

Quickstart

Learn

Resources

SDK ReferenceError HandlingTestingCLI

Plugins

Better Auth
DocumentationKnowledge BaseBuild with AIAPI ReferenceWebhooks

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

OptionTypeDefaultDescription
apiKeystringrequiredYour API key (starts with ck_)
environment'sandbox' | 'production''sandbox'Target environment
debugbooleanfalseLog requests/responses
timeoutnumber30000Request timeout (ms)
retriesnumber3Max retry attempts

Environments

  • Sandbox (sandbox.commet.co) - Development, default
  • Production (commet.co) - Live billing
commet.isSandbox()     // true
commet.isProduction()  // false

Debug 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 OK

Pagination

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,
  })
}
ParameterTypeDefaultDescription
limitnumber25Items per page (max 100)
cursorstring-Cursor from previous response

How is this guide?

Acceptable Use Policy

What products and services can be sold through Commet.

Error Handling

Handle errors with automatic retries and typed error classes

On this page

Setup
Options
Environments
Debug Mode
Pagination