Skip to main content
PUT
/
api
/
v1-beta
/
customers
/
{id}
/
assignments
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.assignments.upsert('id', {
  assignments: [
    {
      entityId: 'workspace-001',
      featureId: 'compute-minutes',
      usageLimit: 1000,
      cadence: 'P1M',
    },
    {
      entityId: 'workspace-002',
      currencyId: 'cred-type-tokens',
      usageLimit: 2000,
      cadence: 'P1M',
      parentId: 'workspace-001',
      scopeEntityIds: ['user-1'],
    },
  ],
});

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.assignments.upsert(
id="id",
assignments=[{
"entity_id": "workspace-001",
"feature_id": "compute-minutes",
"usage_limit": 1000,
"cadence": "P1M",
}, {
"entity_id": "workspace-002",
"currency_id": "cred-type-tokens",
"usage_limit": 2000,
"cadence": "P1M",
"parent_id": "workspace-001",
"scope_entity_ids": ["user-1"],
}],
)
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.Assignments.Upsert(
context.TODO(),
"id",
stigg.V1BetaCustomerAssignmentUpsertParams{
Assignments: []stigg.V1BetaCustomerAssignmentUpsertParamsAssignment{{
EntityID: "workspace-001",
FeatureID: stigg.String("compute-minutes"),
UsageLimit: stigg.Float(1000),
Cadence: stigg.String("P1M"),
}, {
EntityID: "workspace-002",
CurrencyID: stigg.String("cred-type-tokens"),
UsageLimit: stigg.Float(2000),
Cadence: stigg.String("P1M"),
ParentID: stigg.String("workspace-001"),
ScopeEntityIDs: []string{"user-1"},
}},
},
)
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.assignments.AssignmentUpsertParams;
import io.stigg.models.v1beta.customers.assignments.AssignmentUpsertResponse;

public final class Main {
private Main() {}

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

AssignmentUpsertParams params = AssignmentUpsertParams.builder()
.id("id")
.addAssignment(AssignmentUpsertParams.Assignment.builder()
.entityId("workspace-001")
.build())
.addAssignment(AssignmentUpsertParams.Assignment.builder()
.entityId("workspace-002")
.build())
.build();
AssignmentUpsertResponse response = client.v1Beta().customers().assignments().upsert(params);
}
}
require "stigg"

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

response = stigg.v1_beta.customers.assignments.upsert(
"id",
assignments: [{entityId: "workspace-001"}, {entityId: "workspace-002"}]
)

puts(response)
using System;
using Stigg.Client;
using Stigg.Client.Models.V1Beta.Customers.Assignments;

StiggClient client = new();

AssignmentUpsertParams parameters = new()
{
ID = "id",
Assignments =
[
new()
{
EntityID = "workspace-001",
Cadence = "P1M",
CurrencyID = "currencyId",
FeatureID = "compute-minutes",
ParentID = "parentId",
ScopeEntityIds =
[
"NxI"
],
UsageLimit = 1000,
},
new()
{
EntityID = "workspace-002",
Cadence = "P1M",
CurrencyID = "cred-type-tokens",
FeatureID = "featureId",
ParentID = "workspace-001",
ScopeEntityIds =
[
"user-1"
],
UsageLimit = 2000,
},
],
};

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

Console.WriteLine(response);
stigg v1-beta:customers:assignments upsert \
--api-key 'My API Key' \
--id id \
--assignment '{entityId: workspace-001}' \
--assignment '{entityId: workspace-002}'
curl --request PUT \
--url https://api.stigg.io/api/v1-beta/customers/{id}/assignments \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"assignments": [
{
"entityId": "workspace-001",
"featureId": "compute-minutes",
"usageLimit": 1000,
"cadence": "P1M"
},
{
"entityId": "workspace-002",
"currencyId": "cred-type-tokens",
"usageLimit": 2000,
"cadence": "P1M",
"parentId": "workspace-001",
"scopeEntityIds": [
"user-1"
]
}
]
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1-beta/customers/{id}/assignments",
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([
'assignments' => [
[
'entityId' => 'workspace-001',
'featureId' => 'compute-minutes',
'usageLimit' => 1000,
'cadence' => 'P1M'
],
[
'entityId' => 'workspace-002',
'currencyId' => 'cred-type-tokens',
'usageLimit' => 2000,
'cadence' => 'P1M',
'parentId' => 'workspace-001',
'scopeEntityIds' => [
'user-1'
]
]
]
]),
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": "6f6b9c39-3a14-4a5e-9c6c-2a4f8d8d2f3f",
      "entityId": "workspace-001",
      "featureId": "feature-compute-minutes",
      "scopeEntityIds": [],
      "parentId": null,
      "usageLimit": 1000,
      "cadence": "P1M",
      "createdAt": "2026-05-18T10:00:00.000Z",
      "updatedAt": "2026-05-18T10:00:00.000Z"
    }
  ]
}
{
"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 assignments 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 capability assignments in bulk for a single customer

assignments
UpsertAssignment · object[]
required

Assignments to upsert (1–100 per request)

Required array length: 1 - 100 elements

Response

Assignments after upsert.

Assignments after upsert.

data
Assignment · object[]
required