Skip to main content
PUT
/
api
/
v1-beta
/
customers
/
{id}
/
entities
JavaScript
import Stigg from '@stigg/typescript';

const client = new Stigg({
  apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});

const response = await client.v1Beta.customers.entities.upsert('id', {
  entities: [
    {
      id: 'user-7f3a0c1d',
      typeRefId: 'user',
      metadata: { email: 'jane@acme.com', role: 'admin' },
    },
    {
      id: 'user-c4d1b2e9',
      typeRefId: 'user',
      metadata: { email: 'john@acme.com' },
    },
  ],
});

console.log(response.data);
{
  "data": [
    {
      "id": "user-7f3a0c1d",
      "typeId": "user",
      "metadata": {
        "email": "jane@acme.com",
        "role": "admin"
      },
      "createdAt": "2026-05-18T00:00:00.000Z",
      "updatedAt": "2026-05-18T00:00:00.000Z",
      "archivedAt": null
    },
    {
      "id": "user-c4d1b2e9",
      "typeId": "user",
      "metadata": {
        "email": "john@acme.com"
      },
      "createdAt": "2026-05-18T00:00:00.000Z",
      "updatedAt": "2026-05-18T00:00:00.000Z",
      "archivedAt": null
    }
  ]
}

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-ACCOUNT-ID
string

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-ID
string

Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).

Path Parameters

id
string
required

The customer identifier (owner) the entities belong to

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$

Body

application/json

Request body for creating or updating entities in bulk for a single customer

entities
UpsertEntity · object[]
required

List of entities to create or update (1-100 entries)

Required array length: 1 - 100 elements

Response

The list of upserted entity objects.

List of entities created or updated by an upsert request

data
Entity · object[]
required