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_). The org that owns the key decides whether calls run against sandbox or live data.
debugbooleanfalseLog requests/responses
timeoutnumber30000Request timeout (ms)
retriesnumber3Max retry attempts

Sandbox vs live

There is a single API host, commet.co. Use an API key created in a sandbox organization while integrating; swap it for a key from a live organization when you go to production. No code change beyond the environment variable.

Debug Mode

See all requests and responses:

const commet = new Commet({
  apiKey: process.env.COMMET_API_KEY!,
  debug: true,
})

// [Commet SDK] POST https://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
Sandbox vs live
Debug Mode
Pagination