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',
      entityTypeId: 'user',
      metadata: { email: 'jane@acme.com', role: 'admin' },
    },
    {
      id: 'user-c4d1b2e9',
      entityTypeId: 'user',
      metadata: { email: 'john@acme.com' },
    },
  ],
});

console.log(response.data);
import os
from stigg import Stigg

client = Stigg(
api_key=os.environ.get("STIGG_API_KEY"), # This is the default and can be omitted
)
response = client.v1_beta.customers.entities.upsert(
id="id",
entities=[{
"id": "user-7f3a0c1d",
"entity_type_id": "user",
"metadata": {
"email": "jane@acme.com",
"role": "admin",
},
}, {
"id": "user-c4d1b2e9",
"entity_type_id": "user",
"metadata": {
"email": "john@acme.com"
},
}],
)
print(response.data)
package main

import (
"context"
"fmt"

"github.com/stiggio/stigg-go"
"github.com/stiggio/stigg-go/option"
)

func main() {
client := stigg.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.V1Beta.Customers.Entities.Upsert(
context.TODO(),
"id",
stigg.V1BetaCustomerEntityUpsertParams{
Entities: []stigg.V1BetaCustomerEntityUpsertParamsEntity{{
ID: "user-7f3a0c1d",
EntityTypeID: stigg.String("user"),
Metadata: map[string]string{
"email": "jane@acme.com",
"role": "admin",
},
}, {
ID: "user-c4d1b2e9",
EntityTypeID: stigg.String("user"),
Metadata: map[string]string{
"email": "john@acme.com",
},
}},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package io.stigg.example;

import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1beta.customers.entities.EntityUpsertParams;
import io.stigg.models.v1beta.customers.entities.EntityUpsertResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();

EntityUpsertParams params = EntityUpsertParams.builder()
.id("id")
.addEntity(EntityUpsertParams.Entity.builder()
.id("user-7f3a0c1d")
.build())
.addEntity(EntityUpsertParams.Entity.builder()
.id("user-c4d1b2e9")
.build())
.build();
EntityUpsertResponse response = client.v1Beta().customers().entities().upsert(params);
}
}
require "stigg"

stigg = Stigg::Client.new(api_key: "My API Key")

response = stigg.v1_beta.customers.entities.upsert("id", entities: [{id: "user-7f3a0c1d"}, {id: "user-c4d1b2e9"}])

puts(response)
using System;
using System.Collections.Generic;
using Stigg.Client;
using Stigg.Client.Models.V1Beta.Customers.Entities;

StiggClient client = new();

EntityUpsertParams parameters = new()
{
ID = "id",
Entities =
[
new()
{
ID = "user-7f3a0c1d",
EntityTypeID = "user",
Metadata = new Dictionary<string, string>()
{
{ "email", "jane@acme.com" }, { "role", "admin" }
},
},
new()
{
ID = "user-c4d1b2e9",
EntityTypeID = "user",
Metadata = new Dictionary<string, string>()
{
{ "email", "john@acme.com" }
},
},
],
};

var response = await client.V1Beta.Customers.Entities.Upsert(parameters);

Console.WriteLine(response);
stigg v1-beta:customers:entities upsert \
--api-key 'My API Key' \
--id id \
--entity '{id: user-7f3a0c1d}' \
--entity '{id: user-c4d1b2e9}'
curl --request PUT \
--url https://api.stigg.io/api/v1-beta/customers/{id}/entities \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"entities": [
{
"id": "user-7f3a0c1d",
"entityTypeId": "user",
"metadata": {
"email": "jane@acme.com",
"role": "admin"
}
},
{
"id": "user-c4d1b2e9",
"entityTypeId": "user",
"metadata": {
"email": "john@acme.com"
}
}
]
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1-beta/customers/{id}/entities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'entities' => [
[
'id' => 'user-7f3a0c1d',
'entityTypeId' => 'user',
'metadata' => [
'email' => 'jane@acme.com',
'role' => 'admin'
]
],
[
'id' => 'user-c4d1b2e9',
'entityTypeId' => 'user',
'metadata' => [
'email' => 'john@acme.com'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "data": [
    {
      "id": "user-7f3a0c1d",
      "entityTypeId": "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",
      "entityTypeId": "user",
      "metadata": {
        "email": "john@acme.com"
      },
      "createdAt": "2026-05-18T00:00:00.000Z",
      "updatedAt": "2026-05-18T00:00:00.000Z",
      "archivedAt": null
    }
  ]
}
{
"message": "<string>"
}
{
"message": "<string>",
"code": "Unauthenticated"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>",
"code": "RateLimitExceeded"
}

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