Create and manage code redemption campaigns
Overview
This article walks you through how to do the following in the AccelByte Gaming Services (AGS) Admin Portal or with the AGS CLI:
- View code redemption campaigns
- Activate or deactivate code redemption campaigns
- Create a code redemption campaign
- Add items to a code redemption campaign
- Add and manage subscription plans in an item code redemption campaign
- Create and manage codes in a code redemption campaign
- Download codes from a code redemption campaign
- View code redemption history
Prerequisites
- Admin access to the AccelByte Gaming Services (AGS) Admin Portal.
- A published store in your namespace with active items or other entitlements and active subscription plans (if you want to add subscription plans). To learn more about setting up a store in your game namespace, see Manage stores and store items.
- To follow the AGS CLI steps, you have installed the AGS CLI and signed in with an account that has permissions to manage code redemption campaigns. See Install and sign in.
View code redemption campaigns
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, find the campaign you want to activate or deactivate, then click on its corresponding View button. The details page of the campaign appears. On this page, you can view the configuration details, codes, and redemption history of the campaign.
-
List the campaigns in your namespace. Replace
<YourNamespace>with your game namespace. To search by name, add--name <CampaignName>.ags platform campaigns list --namespace <YourNamespace> -
View the configuration details of a campaign. Replace
<CampaignId>with the campaign'sidfrom the list.ags platform campaigns get --namespace <YourNamespace> --campaign-id <CampaignId>
To view the codes and redemption history of the campaign, see View codes and View code redemption history.
Activate or deactivate code redemption campaigns
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, find the campaign you want to activate or deactivate, then click on its corresponding View button.
- On the details page of the campaign, click on the Activate or Deactivate button. The campaign is immediately activated or deactivated.
-
Save the campaign's current settings to a file:
ags platform campaigns get --namespace <YourNamespace> --campaign-id <CampaignId> --format json > campaign.json -
In
campaign.json, setstatustoACTIVEorINACTIVE. -
Send the file back. The campaign is immediately activated or deactivated.
ags platform campaigns update --namespace <YourNamespace> --campaign-id <CampaignId> --json @campaign.jsonwarningAn update replaces the campaign's settings with the request body. If you leave out
redeemStartorredeemEnd, the update clears the campaign's start or end time. To keep the settings you don't change, always send the full file that you saved withget.
Create code redemption campaigns
This section covers how to create an item code redemption campaign and a discount code redemption campaign.
Create an item code redemption campaign
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the + Create Redemption Code. On the Create Code Redemption form appears.
- Fill in the required information on the form.
- Basic Information
- Code Redemption Name: type in a name for the campaign.
- Start Time and End Time: set the start and end date and time for the campaign.
- Redemption Type: set to Item.
- (Optional) Description: provide a brief description of the campaign.
- Redemption Rules
- Redemption Limit per Code: specify the maximum number of times a single code in this campaign can be redeemed, or set this to unlimited by ticking the Set as Unlimited checkbox. For instance, a limit of 1 ensures that each code can only be redeemed once.
- Redemption Limit per Account: specify the maximum number of times a single code in this campaign can be redeemed by a single player, or set this to unlimited by ticking the Set as Unlimited checkbox. For example, a limit of 1 ensures that a single code can only be redeemed once by a single player.
- Multiple Code Redemption Limit per Account: specify the maximum number of codes a single player can redeem in the campaign, or set this to unlimited by ticking the Set as Unlimited checkbox. For example, a limit of 3 ensures that a player can only redeem up to three different codes in the campaign, after which they will be ineligible for further redemptions.
- Basic Information
- Click Create. By default, code redemption campaigns are active upon creation.
- Add items to the campaign. See Add items to a code redemption campaign. For item code redemption campaigns, you also have the option to add subscription plans on top of (as add-on benefits) or instead of items in the campaign. See Add and manage subscription plans in an item code redemption campaign.
- Create or generate codes for the campaign.
-
Create a JSON file with the campaign's settings. Any file name works. This example uses
campaign.json:{
"name": "<CampaignName>",
"description": "<Description>",
"redeemType": "ITEM",
"redeemStart": "2026-11-01T00:00:00.000Z",
"redeemEnd": "2026-12-01T00:00:00.000Z",
"maxRedeemCountPerCode": 1,
"maxRedeemCountPerCodePerUser": 1,
"maxRedeemCountPerCampaignPerUser": 1
}-
name: up to 48 characters. It must start and end with a letter or number, and you can separate words with spaces or with',,,., or-. -
description: optional. -
redeemStartandredeemEnd: the start and end time of the campaign, in UTC. -
The redemption limits match the Admin Portal fields below. To make a limit unlimited, set it to
-1.Admin Portal field Request body field Redemption Limit per Code maxRedeemCountPerCodeRedemption Limit per Account maxRedeemCountPerCodePerUserMultiple Code Redemption Limit per Account maxRedeemCountPerCampaignPerUser
-
-
Create the campaign. After
@, pass the path to your JSON file:ags platform campaigns create --namespace <YourNamespace> --json @campaign.jsonThe command prints the new campaign. Its
idis the campaign ID that the other commands on this page use. By default, code redemption campaigns are active upon creation. -
Add items to the campaign. See Add items to a code redemption campaign. You can also add subscription plans on top of or instead of items. See Add and manage subscription plans in an item code redemption campaign.
-
Create or generate codes for the campaign.
Create a discount code redemption campaign
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the + Create Redemption Code. On the Create Code Redemption form appears.
- Fill in the required information on the form.
- Basic Information
- Code Redemption Name: type in a name for the campaign.
- Start Time and End Time: set the start and end date and time for the campaign.
- Redemption Type: set to Discount.
- (Optional) Description: provide a brief description of the campaign.
- Redemption Rules
- Redemption Limit per Code: specify the maximum number of times a single code in this campaign can be redeemed, or set this to unlimited by ticking the Set as Unlimited checkbox. For instance, a limit of 1 ensures that each code can only be redeemed once.
- Redemption Limit per Account: specify the maximum number of times a single code in this campaign can be redeemed by a single player, or set this to unlimited by ticking the Set as Unlimited checkbox. For example, a limit of 1 ensures that a single code can only be redeemed once by a single player.
- Multiple Code Redemption Limit per Account: specify the maximum number of codes a single player can redeem in the campaign, or set this to unlimited by ticking the Set as Unlimited checkbox. For example, a limit of 3 ensures that a player can only redeem up to three different codes in the campaign, after which they will be ineligible for further redemptions.
- Discount Configuration
- Currency Namespace: this cannot be edited.
- Currency: from the dropdown, select the currency that will be used for the campaign.
- Discount Type: set to Percentage to use a percentage discount or to Amount to use a fixed discount amount.
- Discount Amount: type in the discount amount based on what you selected for Discount Type.
- Discount Application: set to All Items or to Specific Items.
- Stackable Discounts: turn on this toggle if you want the discount code to be applied with other stackable discount codes at the same time.
- Basic Information
- Click Create. By default, code redemptions are active upon creation.
- Add items to the campaign. See Add items to a code redemption campaign.
- Create or generate codes for the campaign.
-
Find the code of the currency that the discount uses:
ags platform currencies list --namespace <YourNamespace> -
Create a JSON file with the campaign's settings. Any file name works. This example uses
campaign.json:{
"name": "<CampaignName>",
"description": "<Description>",
"redeemType": "DISCOUNT",
"redeemStart": "2026-11-01T00:00:00.000Z",
"redeemEnd": "2026-12-01T00:00:00.000Z",
"maxRedeemCountPerCode": 1,
"maxRedeemCountPerCodePerUser": 1,
"maxRedeemCountPerCampaignPerUser": 1,
"discountConfig": {
"currencyNamespace": "<YourNamespace>",
"currencyCode": "<CurrencyCode>",
"discountType": "PERCENTAGE",
"discountPercentage": 10,
"restrictType": "NONE",
"stackable": false
}
}The fields outside
discountConfigwork the same as in Create an item code redemption campaign. IndiscountConfig:currencyNamespace: the namespace of the currency. The Admin Portal fills this in for you. In AGS Public Cloud, it must be your game namespace. In AGS Private Cloud, it can be your game namespace or your publisher namespace.currencyCode: thecurrencyCodefrom step 1.discountType:PERCENTAGEfor a percentage discount, set indiscountPercentage.AMOUNTfor a fixed discount, set indiscountAmountinstead.discountAmount: the discount in the currency's smallest unit. For a currency withdecimalsset to2,150is a discount of 1.50.restrictType:NONEapplies the discount to all items.ITEMS_AND_CATEGORIESapplies it to specific items only, which you add in Add items to a code redemption campaign.stackable:truelets players use the code together with other stackable discount codes.
-
Create the campaign. After
@, pass the path to your JSON file:ags platform campaigns create --namespace <YourNamespace> --json @campaign.jsonThe command prints the new campaign. Its
idis the campaign ID that the other commands on this page use. By default, code redemption campaigns are active upon creation. -
If the discount applies to specific items, add them to the campaign. See Add items to a code redemption campaign.
-
Create or generate codes for the campaign.
Add items to a code redemption campaign
You can add items to a newly created or to an existing and ongoing item or discount code redemption campaign.
Only add active items to the campaign. If inactive items are added to the campaign, the codes in the campaign will not work and cannot be redeemed by players.
- Admin Portal
- AGS CLI
To add items to an item or discount code redemption campaign, follow these steps:
-
In the Admin Portal, go to your game namespace.
-
On the sidebar, go to Online > Store & Catalog > Code Redemptions.
-
On the Code Redemptions page, find the code redemption campaign you want to update and click on its View button. The campaign's details page appears.
-
On the details page, open the Details tab and scroll down to the Items section.
-
Click on + Add Item. The Add items window appears.
-
Search and select the active items that you want to add to the campaign.
noteThe items that you can add to a campaign are from your game's active or published store, which is managed through the AGS Store service. To learn more about creating subscription packages, see Create store items.
-
After selecting the items you want to add, click on Add. The items are automatically added to the campaign. If the campaign is active and ongoing, the items are also immediately available for redemption in the campaign.
-
You also have the option to add subscription plans on top of (as add-on benefits) or instead of items in the campaign. See Add and manage subscription plans in an item code redemption campaign.
-
Create or generate codes for the campaign.
-
Find the ID and name of each active item that you want to add. The command searches your game's published store. Each item in the output has an
itemIdand aname.ags platform items list --namespace <YourNamespace> --item-name <ItemName> --item-status ACTIVE -
Save the campaign's current settings to a file:
ags platform campaigns get --namespace <YourNamespace> --campaign-id <CampaignId> --format json > campaign.json -
In
campaign.json, add an entry for each item. Use the item'snameasitemName.-
For an item code redemption campaign, add the entries to the
itemslist:"items": [
{
"itemId": "<ItemId>",
"itemName": "<ItemName>"
}
] -
For a discount code redemption campaign, add the entries to the
itemslist insidediscountConfig, and make surerestrictTypeisITEMS_AND_CATEGORIES:"discountConfig": {
"restrictType": "ITEMS_AND_CATEGORIES",
"items": [
{
"itemId": "<ItemId>",
"itemName": "<ItemName>"
}
]
}Keep the other
discountConfigfields that are already in the file.
If the list already has entries, keep them and add yours after them.
-
-
Send the file back. If the campaign is active and ongoing, the items are immediately available for redemption in the campaign.
ags platform campaigns update --namespace <YourNamespace> --campaign-id <CampaignId> --json @campaign.json -
You can also add subscription plans to an item code redemption campaign. See Add and manage subscription plans in an item code redemption campaign.
-
Create or generate codes for the campaign.
Add and manage subscription plans in an item code redemption campaign
You also have the option to add subscription plans on top of (as add-on benefits) or instead of items in an item code redemption campaign.
Add a subscription plan
- Admin Portal
- AGS CLI
-
In the Admin Portal, go to your game namespace.
-
On the sidebar, go to Online > Store & Catalog > Code Redemptions.
-
On the Code Redemptions page, find the item code redemption campaign you want to update and click on its View button. The campaign's details page appears.
-
On the campaign's details page, open the Details tab and scroll down to the Subscription Time section.
-
Click on + Add Subscription. The Add Subscription form appears.
-
In the Subscription field, search for the subscription type that you want to add to the campaign.
noteThe subscription plans that you can add to a campaign are from your game's active or published store, which is managed through the AGS Store service. To learn more about creating subscription plans, see Create store items.
-
In the Duration field, specify the number of days the subscription will be granted to players. The maximum limit for this option is 2,147,483,647 days.
-
Click Add to add the subscription plan to the campaign. The subscription plan is immediately active and available in the campaign. If the campaign is active and ongoing, the subscription plans you added are also immediately available for redemption in the campaign.
-
Find the ID and name of the subscription plan. The command searches your game's published store. Each item in the output has an
itemIdand aname.ags platform items list --namespace <YourNamespace> --item-type SUBSCRIPTION --item-status ACTIVE -
Save the campaign's current settings to a file:
ags platform campaigns get --namespace <YourNamespace> --campaign-id <CampaignId> --format json > campaign.json -
In
campaign.json, add an entry for the subscription plan to theitemslist. If the list already has entries, keep them."items": [
{
"itemId": "<SubscriptionItemId>",
"itemName": "<SubscriptionName>",
"extraSubscriptionDays": 30
}
]extraSubscriptionDaysis the Duration: the number of days the subscription is granted to players. -
Send the file back. If the campaign is active and ongoing, the subscription plan is immediately available for redemption in the campaign.
ags platform campaigns update --namespace <YourNamespace> --campaign-id <CampaignId> --json @campaign.json
Remove subscription plans
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, find the item code redemption campaign you want to update and click on its View button. The campaign's details page appears.
- On the details page, go to the Details tab and scroll down to the Subscription Time section.
- Click on the Remove option of the subscription plan that you want to remove from the campaign and click on Confirm on the pop-up that appears. The subscription plan is immediately removed from the campaign.
-
Save the campaign's current settings to a file:
ags platform campaigns get --namespace <YourNamespace> --campaign-id <CampaignId> --format json > campaign.json -
In
campaign.json, delete the subscription plan's entry from theitemslist. -
Send the file back. The subscription plan is immediately removed from the campaign.
ags platform campaigns update --namespace <YourNamespace> --campaign-id <CampaignId> --json @campaign.json
Create and manage codes in a code redemption campaign
This section covers how to manage codes in a code redemption campaign.
View codes
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the View button of the campaign with the codes you want to view. The campaign's details page appears.
- On the details page, open the Codes tab. The Codes page appears, showing a table of active and deactivated codes in the campaign. You can search for specific codes in the table.
List the active and deactivated codes in the campaign. Each code's value is the code itself. To search for a specific code, add --code <Code>.
ags platform campaign-codes list --namespace <YourNamespace> --campaign-id <CampaignId>
Create or generate codes
- Admin Portal
- AGS CLI
-
In the Admin Portal, go to your game namespace.
-
On the sidebar, go to Online > Store & Catalog > Code Redemptions.
-
On the Code Redemptions page, click on the View button of the campaign you want to create codes for. The campaign's details page appears.
-
On the campaign's details page, open the Codes tab. The Codes page appears.
-
Click on the Generate Codes button. The Generate Codes form appears.
-
On the form, do one of the following:
- Select Random-Generated Code to generate random codes. With this option, you can specify the number of random codes you want to generate for the campaign in in the Code Amount field. You can generate up to 999 codes at once.
- Select Custom Code to manually create a code for the campaign. Then, in the Code Name field, type in your custom code.
importantCustom codes cannot be edited or deleted after creation.
-
Click Generate. The codes you generated or manually created are added and activated in the campaign. At any time, you can repeat these steps to create or generate more codes for the campaign.
Run one of the following commands. In both, batchName is a required label for this batch of codes, 3 to 60 characters long.
-
To generate random codes, set
quantityto the number of codes you want. You can generate up to 999 codes at once.ags platform campaign-codes create --namespace <YourNamespace> --campaign-id <CampaignId> \
--json '{"batchName": "<BatchName>", "quantity": 100}' -
To create a custom code, set
codeValueto your code. It must be 6 to 20 letters and numbers.ags platform campaign-codes create --namespace <YourNamespace> --campaign-id <CampaignId> \
--json '{"batchName": "<BatchName>", "codeValue": "<YourCode>"}'warningCustom codes cannot be edited or deleted after creation.
The codes are added and activated in the campaign. You can run the command again at any time to create more codes.
Activate or deactivate codes
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the View button of the campaign you want to create codes for. The campaign's details page appears.
- On the campaign's details page, open the Codes tab. The Codes page appears, showing a list of the active and inactive codes in the campaign.
- From the list, find the code that you want to activate or deactivate and click on its Activate or Deactivate option. Then, click on Confirm on the pop-up window that appears. The code is immediately activated or deactivated in the campaign.
Replace <Code> with the code's value from View codes. The code is immediately activated or deactivated in the campaign.
-
To activate a code, run:
ags platform campaign-codes enable --namespace <YourNamespace> --code <Code> -
To deactivate a code, run:
ags platform campaign-codes disable --namespace <YourNamespace> --code <Code>
Download campaign codes
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the View button of the campaign you want to create codes for. The campaign's details page appears.
- On the campaign's details page, open the Codes page. The Codes page appears, showing a list of the active and inactive codes in the campaign.
- To download all the codes in the campaign, click on the Download Code button at the top of the list. A CSV file containing all the codes in the campaign is downloaded.
Save all the codes in the campaign to a CSV file. Any file name works. This example uses codes.csv.
ags platform campaign-codes export --namespace <YourNamespace> --campaign-id <CampaignId> --output codes.csv
View code redemption history
- Admin Portal
- AGS CLI
- In the Admin Portal, go to your game namespace.
- On the sidebar, go to Online > Store & Catalog > Code Redemptions.
- On the Code Redemptions page, click on the View button of the campaign with the redemption history you want to view. The campaign's details page appears.
- On the campaign's details page, open the Redeem History tab. The Redeem History page appears, showing a list of codes that have been redeemed in the campaign.
- On the page, you can search the redemption history by user ID or by code ID.
List the codes that have been redeemed in the campaign. To search the history, add --user-id <UserId> or --code <Code>.
ags platform campaign-codes list-redemptions --namespace <YourNamespace> --campaign-id <CampaignId>