Player Item Management - Unlock Container Instance

NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2. Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.

POST https://titleId.playfabapi.com/Client/UnlockContainerInstance

Request Header

Name Required Type Description
X-Authorization True

string

This API requires a client session ticket, available from any Client Login function.

Request Body

Name Required Type Description
ContainerItemInstanceId True

string

ItemInstanceId of the container to unlock.

CatalogVersion

string

Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance.

CharacterId

string

Unique PlayFab assigned ID for a specific character owned by a user

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

KeyItemInstanceId

string

ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required.

Responses

Name Type Description
200 OK

UnlockContainerItemResult

The items and vc found within the container. These will be added and stacked in the appropriate inventory.

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-Authorization

This API requires a client session ticket, available from any Client Login function.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

ItemInstance

A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

UnlockContainerInstanceRequest

Specify the container and optionally the catalogVersion for the container to open

UnlockContainerItemResult

The items and vc found within the container. These will be added and stacked in the appropriate inventory.

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

ItemInstance

A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

Name Type Description
Annotation

string

Game specific comment associated with this instance when it was added to the user inventory.

BundleContents

string[]

Array of unique items that were awarded when this catalog item was purchased.

BundleParent

string

Unique identifier for the parent inventory item, as defined in the catalog, for object which were added from a bundle or container.

CatalogVersion

string

Catalog version for the inventory item, when this instance was created.

CustomData

object

A set of custom key-value pairs on the instance of the inventory item, which is not to be confused with the catalog item's custom data.

DisplayName

string

CatalogItem.DisplayName at the time this item was purchased.

Expiration

string

Timestamp for when this instance will expire.

ItemClass

string

Class name for the inventory item, as defined in the catalog.

ItemId

string

Unique identifier for the inventory item, as defined in the catalog.

ItemInstanceId

string

Unique item identifier for this specific instance of the item.

PurchaseDate

string

Timestamp for when this instance was purchased.

RemainingUses

number

Total number of remaining uses, if this is a consumable item.

UnitCurrency

string

Currency type for the cost of the catalog item. Not available when granting items.

UnitPrice

number

Cost of the catalog item in the given currency. Not available when granting items.

UsesIncrementedBy

number

The number of uses that were added or removed to this item in this call.

UnlockContainerInstanceRequest

Specify the container and optionally the catalogVersion for the container to open

Name Type Description
CatalogVersion

string

Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance.

CharacterId

string

Unique PlayFab assigned ID for a specific character owned by a user

ContainerItemInstanceId

string

ItemInstanceId of the container to unlock.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

KeyItemInstanceId

string

ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required.

UnlockContainerItemResult

The items and vc found within the container. These will be added and stacked in the appropriate inventory.

Name Type Description
GrantedItems

ItemInstance[]

Items granted to the player as a result of unlocking the container.

UnlockedItemInstanceId

string

Unique instance identifier of the container unlocked.

UnlockedWithItemInstanceId

string

Unique instance identifier of the key used to unlock the container, if applicable.

VirtualCurrency

object

Virtual currency granted to the player as a result of unlocking the container.

Error Codes

Name Code
CharacterNotFound 1135
ContainerKeyInvalid 1205
ContainerNotOwned 1018
InvalidContainerItem 1017
InvalidItemIdInTable 1020
InvalidItemProperties 1091
KeyNotOwned 1019