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

const autumn = new Autumn();

const { data, error } = await autumn.entities.create('customer_id', { id: 'id', feature_id: 'feature_id' });
{
  "id": "seat_123",
  "name": "John Doe's Seat",
  "customer_id": "org_123",
  "created_at": 1762971906762,
  "env": "sandbox",
  "products": [
    {
      "id": "pro_plan",
      "name": "Pro Plan",
      "group": null,
      "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": "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": 30,
      "next_reset_at": 1765563905000,
      "overage_allowed": false
    }
  }
}
You can create multiple entities at once by passing an array of entities.

Authorizations

Authorization
string
header
required

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

Path Parameters

customer_id
string
required

Body

application/json
id
string | null
required

The ID of the entity

feature_id
string
required

The ID of the feature this entity is associated with

name
string | null

The name of the entity

customer_data
object

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

Response

200 - application/json
id
string | null
required

The unique identifier of the entity.

name
string | null
required

The name of the entity.

created_at
number
required

Unix timestamp (in milliseconds) when the entity was created.

env
enum<string>
required
Available options:
sandbox,
live
customer_id
string | null

The customer ID this entity belongs to.

feature_id
string | null

The feature ID this entity belongs to.

products
object[]

The products this entity has access to.

features
object

The features this entity has access to.

invoices
object[]

The invoices for this entity. Returned only if 'invoices' is passed into the expand parameter.