> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grant Items To Users

> _NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2._ Adds the specified items to the specified user inventories

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| AccountNotFound | 1001 |
| CatalogNotConfigured | 1218 |
| ProductDisabledForTitle | 1609 |




## OpenAPI

````yaml post /Admin/GrantItemsToUsers
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Admin API
  description: >-
    APIs for managing title configurations, uploaded Game Server code
    executables, and user data
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Account Management
    description: Account Management APIs
  - name: Authentication
    description: Authentication APIs
  - name: Characters
    description: Characters APIs
  - name: Content
    description: Content Service APIs
  - name: Custom Server Management
    description: Custom Server Management APIs
  - name: Matchmaking
    description: Matchmaking APIs
  - name: Player Data Management
    description: Player Data Management APIs
  - name: Player Item Management
    description: Player Item Management APIs
  - name: PlayStream
    description: PlayStream Management APIs
  - name: ScheduledTask
    description: Task management APIs
  - name: Segments
    description: Segment management APIs
  - name: Server-Side Cloud Script
    description: Server-Side Cloud Script APIs
  - name: Shared Group Data
    description: Shared Group Data APIs
  - name: Title-Wide Data Management
    description: Title-Wide Data Management APIs
  - name: Xbox Store
    description: Xbox Store APIs
paths:
  /Admin/GrantItemsToUsers:
    post:
      tags:
        - Player Item Management
      summary: Grant Items To Users
      description: >
        _NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new
        Economy features are being developed only for version 2._ Adds the
        specified items to the specified user inventories


        ## Error codes


        This operation may return the following PlayFab errors:


        | Error | Code |

        | --- | --- |

        | AccountNotFound | 1001 |

        | CatalogNotConfigured | 1218 |

        | ProductDisabledForTitle | 1609 |
      operationId: GrantItemsToUsers
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GrantItemsToUsersRequest'
        description: >-
          This function directly adds inventory items to user inventories. As a
          result of this operations, the user will not be charged any
          transaction fee, regardless of the inventory item catalog definition.
          Please note that the processing time for inventory grants and
          purchases increases fractionally the more items are in the inventory,
          and the more items are in the grant/purchase operation.
      responses:
        '200':
          $ref: '#/components/responses/GrantItemsToUsersResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SecretKey: []
components:
  schemas:
    GrantItemsToUsersRequest:
      description: >-
        This function directly adds inventory items to user inventories. As a
        result of this operations, the user will not be charged any transaction
        fee, regardless of the inventory item catalog definition. Please note
        that the processing time for inventory grants and purchases increases
        fractionally the more items are in the inventory, and the more items are
        in the grant/purchase operation.
      type: object
      properties:
        CatalogVersion:
          description: Catalog version from which items are to be granted.
          type: string
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        ItemGrants:
          description: >-
            Array of items to grant and the users to whom the items are to be
            granted.
          type: array
          items:
            $ref: '#/components/schemas/ItemGrant'
          x-isUnordered: true
          x-isclass: true
      required:
        - ItemGrants
      example:
        CatalogVersion: '5'
        ItemGrants:
          - PlayFabId: '20394883'
            ItemId: shield_level_1
            Annotation: Entered Level 2
          - PlayFabId: '20394883'
            ItemId: shield_level_2
            Annotation: Entered Level 2
            Data:
              Equipped: 'True'
              Slot: Head
    ItemGrant:
      type: object
      properties:
        Annotation:
          description: >-
            String detailing any additional information concerning this
            operation.
          type: string
        CharacterId:
          description: Unique PlayFab assigned ID for a specific character owned by a user
          type: string
        Data:
          description: >-
            Key-value pairs to be written to the custom data. Note that keys are
            trimmed of whitespace, are limited in size, and may not begin with a
            '!' character or be null.
          type: object
        ItemId:
          description: Unique identifier of the catalog item to be granted to the user.
          type: string
        KeysToRemove:
          description: >-
            Optional list of Data-keys to remove from UserData. Some SDKs cannot
            insert null-values into Data due to language constraints. Use this
            to delete the keys directly.
          type: array
          items:
            type: string
        PlayFabId:
          description: >-
            Unique PlayFab assigned ID of the user on whom the operation will be
            performed.
          type: string
      required:
        - PlayFabId
        - ItemId
      example:
        PlayFabId: '20394883'
        ItemId: Crate 1
        Annotation: Entered Level 2
        Data:
          Equipped: 'True'
          Slot: Head
    GrantItemsToUsersResult:
      description: >-
        Please note that the order of the items in the response may not match
        the order of items in the request.
      type: object
      properties:
        ItemGrantResults:
          description: Array of items granted to users.
          type: array
          items:
            $ref: '#/components/schemas/GrantedItemInstance'
          x-isclass: true
      example:
        ItemGrantResults:
          - PlayFabId: '20394883'
            Result: true
            ItemId: shield_level_1
            ItemInstanceId: '133713371337'
            ItemClass: shields
            PurchaseDate: '2017-03-07T00:00:00'
            Expiration: '2018-10-01T00:00:00'
            RemainingUses: 10
            Annotation: Entered Level 2
            CatalogVersion: '5'
            BundleParent: crate block 1
          - PlayFabId: '20394883'
            Result: true
            ItemId: shield_level_2
            ItemInstanceId: '133713371337'
            ItemClass: shields
            PurchaseDate: '2017-03-07T00:00:00'
            Expiration: '2018-10-01T00:00:00'
            RemainingUses: 10
            Annotation: Entered Level 2
            CatalogVersion: '5'
            BundleParent: crate block 1
            CustomData:
              Equipped: 'True'
              Slot: Head
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
    GrantedItemInstance:
      description: >-
        Result of granting an item to a user. 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.
      type: object
      properties:
        Annotation:
          description: >-
            Game specific comment associated with this instance when it was
            added to the user inventory.
          type: string
        BundleContents:
          description: >-
            Array of unique items that were awarded when this catalog item was
            purchased.
          type: array
          items:
            type: string
        BundleParent:
          description: >-
            Unique identifier for the parent inventory item, as defined in the
            catalog, for object which were added from a bundle or container.
          type: string
        CatalogVersion:
          description: >-
            Catalog version for the inventory item, when this instance was
            created.
          type: string
        CharacterId:
          description: Unique PlayFab assigned ID for a specific character owned by a user
          type: string
        CustomData:
          description: >-
            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.
          type: object
        DisplayName:
          description: CatalogItem.DisplayName at the time this item was purchased.
          type: string
        Expiration:
          description: Timestamp for when this instance will expire.
          type: string
        ItemClass:
          description: Class name for the inventory item, as defined in the catalog.
          type: string
        ItemId:
          description: Unique identifier for the inventory item, as defined in the catalog.
          type: string
        ItemInstanceId:
          description: Unique item identifier for this specific instance of the item.
          type: string
        PlayFabId:
          description: >-
            Unique PlayFab assigned ID of the user on whom the operation will be
            performed.
          type: string
        PurchaseDate:
          description: Timestamp for when this instance was purchased.
          type: string
        RemainingUses:
          description: Total number of remaining uses, if this is a consumable item.
          type: number
          x-actualtype: int32
        Result:
          description: Result of this operation.
          type: boolean
        UnitCurrency:
          description: >-
            Currency type for the cost of the catalog item. Not available when
            granting items.
          type: string
        UnitPrice:
          description: >-
            Cost of the catalog item in the given currency. Not available when
            granting items.
          type: number
          x-actualtype: uint32
        UsesIncrementedBy:
          description: >-
            The number of uses that were added or removed to this item in this
            call.
          type: number
          x-actualtype: int32
      required:
        - Result
        - UnitPrice
      example:
        PlayFabId: '20394883'
        Result: true
        ItemId: shield_level_5
        ItemInstanceId: '133713371337'
        ItemClass: shields
        PurchaseDate: '2017-03-07T00:00:00'
        Expiration: '2018-10-01T00:00:00'
        RemainingUses: 10
        Annotation: Entered Level 2
        CatalogVersion: '5'
        BundleParent: crate block 1
      x-sortKey: ItemInstanceId
  responses:
    GrantItemsToUsersResult:
      description: >-
        Please note that the order of the items in the response may not match
        the order of items in the request.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/GrantItemsToUsersResult'
            example:
              code: 200
              status: OK
              data:
                ItemGrantResults:
                  - PlayFabId: '20394883'
                    Result: true
                    ItemId: shield_level_1
                    ItemInstanceId: '133713371337'
                    ItemClass: shields
                    PurchaseDate: '2017-03-07T00:00:00'
                    Expiration: '2018-10-01T00:00:00'
                    RemainingUses: 10
                    Annotation: Entered Level 2
                    CatalogVersion: '5'
                    BundleParent: crate block 1
                  - PlayFabId: '20394883'
                    Result: true
                    ItemId: shield_level_2
                    ItemInstanceId: '133713371337'
                    ItemClass: shields
                    PurchaseDate: '2017-03-07T00:00:00'
                    Expiration: '2018-10-01T00:00:00'
                    RemainingUses: 10
                    Annotation: Entered Level 2
                    CatalogVersion: '5'
                    BundleParent: crate block 1
                    CustomData:
                      Equipped: 'True'
                      Slot: Head
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    SecretKey:
      type: apiKey
      in: header
      name: X-SecretKey
      description: >-
        This API requires a title secret key, available to title admins, from
        PlayFab Game Manager.

````

## Related topics

- [Grant Items To Users](/services/playfab/api-references/rest/server/player-item-management/grant-items-to-users.md)
- [Grant Items To User](/services/playfab/api-references/rest/server/player-item-management/grant-items-to-user.md)
- [Profile Writes Meter API Description](/services/playfab/pricing/meters/profile-writes.md)
- [Grant Items To Character](/services/playfab/api-references/rest/server/player-item-management/grant-items-to-character.md)
- [Grant Character To User](/services/playfab/api-references/rest/client/characters/grant-character-to-user.md)
