> ## 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.

# Open Trade

> Opens a new outstanding trade. Note that a given item instance may only be in one open trade at a time.

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| ProductDisabledForTitle | 1609 |
| TradeAcceptedCatalogItemInvalid | 1170 |
| TradeAcceptedCatalogItemIsNotTradable | 1182 |
| TradeAcceptedItemIsBundle | 1167 |
| TradeAllowedUsersInvalid | 1171 |
| TradeInventoryItemDoesNotExist | 1172 |
| TradeInventoryItemExpired | 1165 |
| TradeInventoryItemInvalidStatus | 1169 |
| TradeInventoryItemIsAssignedToCharacter | 1157 |
| TradeInventoryItemIsBundle | 1158 |
| TradeInventoryItemIsConsumed | 1173 |
| TradeInventoryItemIsNotTradable | 1181 |
| TradeInventoryItemIsStackable | 1174 |
| TradeMissingOfferedAndAcceptedItems | 1166 |
| TradeWaitForStatusTimeout | 1164 |




## OpenAPI

````yaml /services/playfab/api-references/rest/client/client.openapi.json post /Client/OpenTrade
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Client API
  description: >-
    APIs which provide the full range of PlayFab features available to the
    client - authentication, account and data management, inventory, friends,
    matchmaking, reporting, and platform-specific functionality
  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: Advertising
    description: Advertising APIs
  - name: Analytics
    description: Analytics APIs
  - name: Authentication
    description: Authentication APIs
  - name: Character Data
    description: Character Data APIs
  - name: Characters
    description: Characters APIs
  - name: Content
    description: Content Service APIs
  - name: Friend List Management
    description: Friend List Management APIs
  - name: Matchmaking
    description: Matchmaking APIs
  - name: Platform Specific Methods
    description: Platform Specific Methods 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: 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: Trading
    description: Trading Management APIs
paths:
  /Client/OpenTrade:
    post:
      tags:
        - Trading
      summary: Open Trade
      description: >
        Opens a new outstanding trade. Note that a given item instance may only
        be in one open trade at a time.


        ## Error codes


        This operation may return the following PlayFab errors:


        | Error | Code |

        | --- | --- |

        | ProductDisabledForTitle | 1609 |

        | TradeAcceptedCatalogItemInvalid | 1170 |

        | TradeAcceptedCatalogItemIsNotTradable | 1182 |

        | TradeAcceptedItemIsBundle | 1167 |

        | TradeAllowedUsersInvalid | 1171 |

        | TradeInventoryItemDoesNotExist | 1172 |

        | TradeInventoryItemExpired | 1165 |

        | TradeInventoryItemInvalidStatus | 1169 |

        | TradeInventoryItemIsAssignedToCharacter | 1157 |

        | TradeInventoryItemIsBundle | 1158 |

        | TradeInventoryItemIsConsumed | 1173 |

        | TradeInventoryItemIsNotTradable | 1181 |

        | TradeInventoryItemIsStackable | 1174 |

        | TradeMissingOfferedAndAcceptedItems | 1166 |

        | TradeWaitForStatusTimeout | 1164 |
      operationId: OpenTrade
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenTradeRequest'
      responses:
        '200':
          $ref: '#/components/responses/OpenTradeResponse'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SessionTicket: []
components:
  schemas:
    OpenTradeRequest:
      type: object
      properties:
        AllowedPlayerIds:
          description: >-
            Players who are allowed to accept the trade. If null, the trade may
            be accepted by any player. If empty, the trade may not be accepted
            by any player.
          type: array
          items:
            type: string
        OfferedInventoryInstanceIds:
          description: >-
            Player inventory items offered for trade. If not set, the trade is
            effectively a gift request
          type: array
          items:
            type: string
        RequestedCatalogItemIds:
          description: >-
            Catalog items accepted for the trade. If not set, the trade is
            effectively a gift.
          type: array
          items:
            type: string
      example:
        OfferedInventoryInstanceIds:
          - '1359447'
          - '635691'
        RequestedCatalogItemIds:
          - rare_hat_7
    OpenTradeResponse:
      type: object
      properties:
        Trade:
          allOf:
            - $ref: '#/components/schemas/TradeInfo'
          description: The information about the trade that was just opened.
      example:
        Trade:
          Status: Opening
          TradeId: D819CEC225EA9948C351
          OfferingPlayerId: CD803BF233CE76CC
          OfferedInventoryInstanceIds:
            - '1359447'
            - '635691'
          RequestedCatalogItemIds:
            - rare_hat_7
          OpenedAt: '2015-04-07T09:04:28+00:00'
    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
    TradeInfo:
      type: object
      properties:
        AcceptedInventoryInstanceIds:
          description: >-
            Item instances from the accepting player that are used to fulfill
            the trade. If null, no one has accepted the trade.
          type: array
          items:
            type: string
        AcceptedPlayerId:
          description: >-
            The PlayFab ID of the player who accepted the trade. If null, no one
            has accepted the trade.
          type: string
        AllowedPlayerIds:
          description: >-
            An optional list of players allowed to complete this trade. If null,
            anybody can complete the trade.
          type: array
          items:
            type: string
        CancelledAt:
          description: If set, The UTC time when this trade was canceled.
          type: string
        FilledAt:
          description: If set, The UTC time when this trade was fulfilled.
          type: string
        InvalidatedAt:
          description: If set, The UTC time when this trade was made invalid.
          type: string
        OfferedCatalogItemIds:
          description: The catalogItem Ids of the item instances being offered.
          type: array
          items:
            type: string
        OfferedInventoryInstanceIds:
          description: The itemInstance Ids that are being offered.
          type: array
          items:
            type: string
        OfferingPlayerId:
          description: The PlayFabId for the offering player.
          type: string
        OpenedAt:
          description: The UTC time when this trade was created.
          type: string
        RequestedCatalogItemIds:
          description: The catalogItem Ids requested in exchange.
          type: array
          items:
            type: string
        Status:
          allOf:
            - $ref: '#/components/schemas/TradeStatus'
          description: Describes the current state of this trade.
        TradeId:
          description: The identifier for this trade.
          type: string
    TradeStatus:
      type: string
      enum:
        - Invalid
        - Opening
        - Open
        - Accepting
        - Accepted
        - Filled
        - Cancelled
  responses:
    OpenTradeResponse:
      description: ''
      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/OpenTradeResponse'
            example:
              code: 200
              status: OK
              data:
                Trade:
                  Status: Opening
                  TradeId: D819CEC225EA9948C351
                  OfferingPlayerId: CD803BF233CE76CC
                  OfferedInventoryInstanceIds:
                    - '1359447'
                    - '635691'
                  RequestedCatalogItemIds:
                    - rare_hat_7
                  OpenedAt: '2015-04-07T09:04:28+00:00'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    SessionTicket:
      type: apiKey
      in: header
      name: X-Authorization
      description: >-
        This API requires a client session ticket, available from any Client
        Login function.

````

## Related topics

- [Open Trade](/services/playfab/api-references/rest/client/trading/open-trade.md)
- [Accept Trade](/services/playfab/api-references/rest/client/trading/accept-trade.md)
- [Cancel Trade](/services/playfab/api-references/rest/client/trading/cancel-trade.md)
- [Get Trade Status](/services/playfab/api-references/rest/client/trading/get-trade-status.md)
- [Trading](/services/playfab/economy-monetization/economy/trading/index.md)
