Skip to main content
POST
/
api
/
v1
/
customers
/
{id}
/
promotional-entitlements
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 promotionalEntitlement = await client.v1.customers.promotionalEntitlements.create('x', {
  promotionalEntitlements: [
    {
      customEndDate: '2019-12-27T18:11:19.117Z',
      enumValues: ['string'],
      featureId: 'featureId',
      hasSoftLimit: true,
      hasUnlimitedUsage: true,
      isVisible: true,
      monthlyResetPeriodConfiguration: { accordingTo: 'SubscriptionStart' },
      period: '1 week',
      resetPeriod: 'YEAR',
      usageLimit: -9007199254740991,
      weeklyResetPeriodConfiguration: { accordingTo: 'SubscriptionStart' },
      yearlyResetPeriodConfiguration: { accordingTo: 'SubscriptionStart' },
    },
  ],
});

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

client = Stigg(
    api_key=os.environ.get("STIGG_API_KEY"),  # This is the default and can be omitted
)
promotional_entitlement = client.v1.customers.promotional_entitlements.create(
    id="x",
    promotional_entitlements=[{
        "custom_end_date": datetime.fromisoformat("2019-12-27T18:11:19.117"),
        "enum_values": ["string"],
        "feature_id": "featureId",
        "has_soft_limit": True,
        "has_unlimited_usage": True,
        "is_visible": True,
        "monthly_reset_period_configuration": {
            "according_to": "SubscriptionStart"
        },
        "period": "1 week",
        "reset_period": "YEAR",
        "usage_limit": -9007199254740991,
        "weekly_reset_period_configuration": {
            "according_to": "SubscriptionStart"
        },
        "yearly_reset_period_configuration": {
            "according_to": "SubscriptionStart"
        },
    }],
)
print(promotional_entitlement.data)
package main

import (
	"context"
	"fmt"
	"time"

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

func main() {
	client := stigg.NewClient(
		option.WithAPIKey("My API Key"),
	)
	promotionalEntitlement, err := client.V1.Customers.PromotionalEntitlements.New(
		context.TODO(),
		"x",
		stigg.V1CustomerPromotionalEntitlementNewParams{
			PromotionalEntitlements: []stigg.V1CustomerPromotionalEntitlementNewParamsPromotionalEntitlement{{
				CustomEndDate:     stigg.Time(time.Now()),
				EnumValues:        []string{"string"},
				FeatureID:         "featureId",
				HasSoftLimit:      stigg.Bool(true),
				HasUnlimitedUsage: stigg.Bool(true),
				IsVisible:         stigg.Bool(true),
				MonthlyResetPeriodConfiguration: stigg.V1CustomerPromotionalEntitlementNewParamsPromotionalEntitlementMonthlyResetPeriodConfiguration{
					AccordingTo: "SubscriptionStart",
				},
				Period:      "1 week",
				ResetPeriod: "YEAR",
				UsageLimit:  stigg.Int(-9007199254740991),
				WeeklyResetPeriodConfiguration: stigg.V1CustomerPromotionalEntitlementNewParamsPromotionalEntitlementWeeklyResetPeriodConfiguration{
					AccordingTo: "SubscriptionStart",
				},
				YearlyResetPeriodConfiguration: stigg.V1CustomerPromotionalEntitlementNewParamsPromotionalEntitlementYearlyResetPeriodConfiguration{
					AccordingTo: "SubscriptionStart",
				},
			}},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", promotionalEntitlement.Data)
}
package io.stigg.example;

import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.customers.promotionalentitlements.PromotionalEntitlementCreateParams;
import io.stigg.models.v1.customers.promotionalentitlements.PromotionalEntitlementCreateResponse;
import java.time.OffsetDateTime;

public final class Main {
    private Main() {}

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

        PromotionalEntitlementCreateParams params = PromotionalEntitlementCreateParams.builder()
            .id("x")
            .addPromotionalEntitlement(PromotionalEntitlementCreateParams.PromotionalEntitlement.builder()
                .customEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
                .addEnumValue("string")
                .featureId("featureId")
                .hasSoftLimit(true)
                .hasUnlimitedUsage(true)
                .isVisible(true)
                .monthlyResetPeriodConfiguration(PromotionalEntitlementCreateParams.PromotionalEntitlement.MonthlyResetPeriodConfiguration.builder()
                    .accordingTo(PromotionalEntitlementCreateParams.PromotionalEntitlement.MonthlyResetPeriodConfiguration.AccordingTo.SUBSCRIPTION_START)
                    .build())
                .period(PromotionalEntitlementCreateParams.PromotionalEntitlement.Period._1_WEEK)
                .resetPeriod(PromotionalEntitlementCreateParams.PromotionalEntitlement.ResetPeriod.YEAR)
                .usageLimit(-9007199254740991L)
                .weeklyResetPeriodConfiguration(PromotionalEntitlementCreateParams.PromotionalEntitlement.WeeklyResetPeriodConfiguration.builder()
                    .accordingTo(PromotionalEntitlementCreateParams.PromotionalEntitlement.WeeklyResetPeriodConfiguration.AccordingTo.SUBSCRIPTION_START)
                    .build())
                .yearlyResetPeriodConfiguration(PromotionalEntitlementCreateParams.PromotionalEntitlement.YearlyResetPeriodConfiguration.builder()
                    .accordingTo(PromotionalEntitlementCreateParams.PromotionalEntitlement.YearlyResetPeriodConfiguration.AccordingTo.SUBSCRIPTION_START)
                    .build())
                .build())
            .build();
        PromotionalEntitlementCreateResponse promotionalEntitlement = client.v1().customers().promotionalEntitlements().create(params);
    }
}
require "stigg"

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

promotional_entitlement = stigg.v1.customers.promotional_entitlements.create(
  "x",
  promotional_entitlements: [
    {
      customEndDate: "2019-12-27T18:11:19.117Z",
      enumValues: ["string"],
      featureId: "featureId",
      hasSoftLimit: true,
      hasUnlimitedUsage: true,
      isVisible: true,
      monthlyResetPeriodConfiguration: {accordingTo: :SubscriptionStart},
      period: :"1 week",
      resetPeriod: :YEAR,
      usageLimit: -9007199254740991,
      weeklyResetPeriodConfiguration: {accordingTo: :SubscriptionStart},
      yearlyResetPeriodConfiguration: {accordingTo: :SubscriptionStart}
    }
  ]
)

puts(promotional_entitlement)
using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Customers.PromotionalEntitlements;

StiggClient client = new();

PromotionalEntitlementCreateParams parameters = new()
{
    ID = "x",
    PromotionalEntitlements =
    [
        new()
        {
            CustomEndDate = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
            EnumValues =
            [
                "string"
            ],
            FeatureID = "featureId",
            HasSoftLimit = true,
            HasUnlimitedUsage = true,
            IsVisible = true,
            MonthlyResetPeriodConfiguration = new(
                AccordingTo.SubscriptionStart
            ),
            Period = Period.V1Week,
            ResetPeriod = ResetPeriod.Year,
            UsageLimit = -9007199254740991,
            WeeklyResetPeriodConfiguration = new(
                WeeklyResetPeriodConfigurationAccordingTo.SubscriptionStart
            ),
            YearlyResetPeriodConfiguration = new(
                YearlyResetPeriodConfigurationAccordingTo.SubscriptionStart
            ),
        },
    ],
};

var promotionalEntitlement = await client.V1.Customers.PromotionalEntitlements.Create(parameters);

Console.WriteLine(promotionalEntitlement);
stigg v1:customers:promotional-entitlements create \
  --api-key 'My API Key' \
  --id x \
  --promotional-entitlement "{customEndDate: '2019-12-27T18:11:19.117Z', enumValues: [string], featureId: featureId, hasSoftLimit: true, hasUnlimitedUsage: true, isVisible: true, monthlyResetPeriodConfiguration: {accordingTo: SubscriptionStart}, period: 1 week, resetPeriod: YEAR, usageLimit: -9007199254740991, weeklyResetPeriodConfiguration: {accordingTo: SubscriptionStart}, yearlyResetPeriodConfiguration: {accordingTo: SubscriptionStart}}"
curl --request POST \
  --url https://api.stigg.io/api/v1/customers/{id}/promotional-entitlements \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "promotionalEntitlements": [
    {
      "featureId": "<string>",
      "usageLimit": 0,
      "hasSoftLimit": true,
      "hasUnlimitedUsage": true,
      "customEndDate": "2023-11-07T05:31:56Z",
      "isVisible": true,
      "yearlyResetPeriodConfiguration": {
        "accordingTo": "SubscriptionStart"
      },
      "monthlyResetPeriodConfiguration": {},
      "weeklyResetPeriodConfiguration": {},
      "enumValues": [
        "<string>"
      ]
    }
  ]
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.stigg.io/api/v1/customers/{id}/promotional-entitlements",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'promotionalEntitlements' => [
        [
                'featureId' => '<string>',
                'usageLimit' => 0,
                'hasSoftLimit' => true,
                'hasUnlimitedUsage' => true,
                'customEndDate' => '2023-11-07T05:31:56Z',
                'isVisible' => true,
                'yearlyResetPeriodConfiguration' => [
                                'accordingTo' => 'SubscriptionStart'
                ],
                'monthlyResetPeriodConfiguration' => [
                                
                ],
                'weeklyResetPeriodConfiguration' => [
                                
                ],
                'enumValues' => [
                                '<string>'
                ]
        ]
    ]
  ]),
  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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "description": "<string>",
      "featureId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z",
      "isVisible": true,
      "usageLimit": 123,
      "hasSoftLimit": true,
      "hasUnlimitedUsage": true,
      "resetPeriodConfiguration": {
        "accordingTo": "SubscriptionStart"
      },
      "environmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "enumValues": [
        "<string>"
      ],
      "featureGroupIds": [
        "<string>"
      ]
    }
  ]
}
{
  "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 unique identifier of the entity

Required string length: 1 - 255

Body

application/json

Grant promotional entitlements to a customer for a specified period.

promotionalEntitlements
GrantPromotionalEntitlementRequest · object[]
required

Promotional entitlements to grant

Minimum array length: 1

Response

The granted promotional entitlement objects.

Response object

data
PromotionalEntitlement · object[]
required