Skip to main content
POST
/
customers
TypeScript
import { Autumn } from 'autumn-js';

const autumn = new Autumn();

const { data, error } = await autumn.customers.create({ id: 'id' });
{
  "id": "customer_123",
  "created_at": 1762971906762,
  "name": "John Doe",
  "email": "john@doe.com",
  "fingerprint": null,
  "stripe_id": "cus_J8A5c31A8tlpwN",
  "env": "sandbox",
  "metadata": {},
  "products": [
    {
      "id": "pro_plan",
      "name": "Pro Plan",
      "group": "product_set_1",
      "status": "active",
      "canceled_at": null,
      "started_at": 1762971923843,
      "is_default": false,
      "is_add_on": false,
      "version": 1,
      "current_period_start": 1762971905000,
      "current_period_end": 1765563905000,
      "items": [
        {
          "type": "feature",
          "feature_id": "dashboard",
          "feature_type": "static",
          "included_usage": 0,
          "interval": null,
          "entity_feature_id": null,
          "display": {
            "primary_text": "Dashboard"
          }
        },
        {
          "type": "feature",
          "feature_id": "messages",
          "feature_type": "single_use",
          "included_usage": 30,
          "interval": "month",
          "reset_usage_when_enabled": true,
          "entity_feature_id": null,
          "display": {
            "primary_text": "10 Messages"
          }
        }
      ],
      "quantity": 1
    }
  ],
  "features": {
    "messages": {
      "id": "messages",
      "type": "single_use",
      "name": "Messages",
      "interval": "month",
      "interval_count": 1,
      "unlimited": false,
      "balance": 10,
      "usage": 0,
      "included_usage": 10,
      "next_reset_at": 1765563905000,
      "overage_allowed": false
    },
    "dashboard": {
      "id": "dashboard",
      "type": "static",
      "name": "Dashboard",
      "interval": null,
      "interval_count": null,
      "unlimited": false,
      "balance": 0,
      "usage": 0,
      "included_usage": 0,
      "next_reset_at": null,
      "overage_allowed": false
    }
  }
}
This endpoint is optional. Customers can be also be created by passing in customer_data in the attach, check or track endpoints.
If the customer already exists and you try to create it again, you will simply be returned the customer object (rather than an error being thrown).

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

expand
enum<string>[]

Body

application/json
id
string | null
required

Your unique identifier for the customer

name
string | null

Customer's name

email
string<email> | null

Customer's email address

fingerprint
string

Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse

metadata
object | null

Additional metadata for the customer

stripe_id
string

Stripe customer ID if you already have one

Response

200 - application/json
id
string | null
required

Your unique identifier for the customer.

created_at
number
required

Timestamp of customer creation in milliseconds since epoch.

name
string | null
required

The name of the customer.

email
string | null
required

The email address of the customer.

fingerprint
string | null
required

A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.

stripe_id
string | null
required

Stripe customer ID.

env
enum<string>
required

The environment this customer was created in.

Available options:
sandbox,
live
metadata
object
required

The metadata for the customer.

products
object[]
required

The products the customer has access to.

features
object
required

The features a customer has access to as a dictionary of feature IDs to customer feature objects.

invoices
object[]

The invoices for the customer. Returned only if invoices is provided in the expand parameter.

entities
object[]

The entities for the customer. Returned only if entities is provided in the expand parameter.

trials_used
object[]

The trials used for the customer. Returned only if trials_used is provided in the expand parameter.

rewards
object | null

The rewards for the customer. Returned only if rewards is provided in the expand parameter.

referrals
object[]

The referrals for the customer. Returned only if referrals is provided in the expand parameter.

upcoming_invoice
object | null

The upcoming invoice for the customer. Returned only if upcoming_invoice is provided in the expand parameter.

payment_method
any

The payment method for the customer on Stripe. Returned only if payment_method is provided in the expand parameter.