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

# Accept Trade

> Accepts an open trade (one that has not yet been accepted or cancelled), if the locally signed-in player is in the allowed player list for the trade, or it is open to all players. If the call is successful, the offered and accepted items will be swapped between the two players' inventories.

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| ProductDisabledForTitle | 1609 |
| TradeAcceptedCatalogItemInvalid | 1170 |
| TradeAcceptedItemsMismatch | 1175 |
| TradeAcceptingUserNotAllowed | 1156 |
| TradeAllowedUsersInvalid | 1171 |
| TradeAlreadyFilled | 1163 |
| TradeCancelled | 1162 |
| TradeDoesNotExist | 1161 |
| TradeInventoryItemDoesNotExist | 1172 |
| TradeInventoryItemExpired | 1165 |
| TradeInventoryItemInvalidStatus | 1169 |
| TradeInventoryItemIsAssignedToCharacter | 1157 |
| TradeInventoryItemIsBundle | 1158 |
| TradeInventoryItemIsConsumed | 1173 |
| TradeInventoryItemIsNotTradable | 1181 |
| TradeInventoryItemIsStackable | 1174 |
| TradeStatusNotValidForAccepting | 1160 |
| TradeWaitForStatusTimeout | 1164 |




## OpenAPI

````yaml /services/playfab/api-references/rest/client/client.openapi.json post /Client/AcceptTrade
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/AcceptTrade:
    post:
      tags:
        - Trading
      summary: Accept Trade
      description: >
        Accepts an open trade (one that has not yet been accepted or cancelled),
        if the locally signed-in player is in the allowed player list for the
        trade, or it is open to all players. If the call is successful, the
        offered and accepted items will be swapped between the two players'
        inventories.


        ## Error codes


        This operation may return the following PlayFab errors:


        | Error | Code |

        | --- | --- |

        | ProductDisabledForTitle | 1609 |

        | TradeAcceptedCatalogItemInvalid | 1170 |

        | TradeAcceptedItemsMismatch | 1175 |

        | TradeAcceptingUserNotAllowed | 1156 |

        | TradeAllowedUsersInvalid | 1171 |

        | TradeAlreadyFilled | 1163 |

        | TradeCancelled | 1162 |

        | TradeDoesNotExist | 1161 |

        | TradeInventoryItemDoesNotExist | 1172 |

        | TradeInventoryItemExpired | 1165 |

        | TradeInventoryItemInvalidStatus | 1169 |

        | TradeInventoryItemIsAssignedToCharacter | 1157 |

        | TradeInventoryItemIsBundle | 1158 |

        | TradeInventoryItemIsConsumed | 1173 |

        | TradeInventoryItemIsNotTradable | 1181 |

        | TradeInventoryItemIsStackable | 1174 |

        | TradeStatusNotValidForAccepting | 1160 |

        | TradeWaitForStatusTimeout | 1164 |
      operationId: AcceptTrade
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AcceptTradeRequest'
      responses:
        '200':
          $ref: '#/components/responses/AcceptTradeResponse'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SessionTicket: []
components:
  schemas:
    AcceptTradeRequest:
      type: object
      properties:
        AcceptedInventoryInstanceIds:
          description: >-
            Items from the accepting player's inventory in exchange for the
            offered items in the trade. In the case of a gift, this will be
            null.
          type: array
          items:
            type: string
        OfferingPlayerId:
          description: Player who opened the trade.
          type: string
        TradeId:
          description: Trade identifier.
          type: string
      required:
        - OfferingPlayerId
        - TradeId
      example:
        OfferingPlayerId: CD803BF233CE76CC
        TradeId: D819CEC225EA9948C351
        AcceptedInventoryInstanceIds:
          - 95C1797ADDAC24DC0383
          - 0F7793DF55CCEAF21B84
    AcceptTradeResponse:
      type: object
      properties:
        Trade:
          allOf:
            - $ref: '#/components/schemas/TradeInfo'
          description: Details about trade which was just accepted.
      example:
        Trade:
          Status: Filled
          TradeId: D819CEC225EA9948C351
          OfferingPlayerId: CD803BF233CE76CC
          OfferedInventoryInstanceIds:
            - '1359447'
            - '635691'
          OfferedCatalogItemIds:
            - gun_1
            - skin_3
          RequestedCatalogItemIds:
            - rare_hat_7
          AcceptedPlayerId: 461535E1EF4150A86889
          AcceptedInventoryInstanceIds:
            - 95C1797ADDAC24DC0383
            - 0F7793DF55CCEAF21B84
          OpenedAt: '2015-04-07T09:04:28+00:00'
          FilledAt: '2015-04-07T09:20:53+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:
    AcceptTradeResponse:
      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/AcceptTradeResponse'
            example:
              code: 200
              status: OK
              data:
                Trade:
                  Status: Filled
                  TradeId: D819CEC225EA9948C351
                  OfferingPlayerId: CD803BF233CE76CC
                  OfferedInventoryInstanceIds:
                    - '1359447'
                    - '635691'
                  OfferedCatalogItemIds:
                    - gun_1
                    - skin_3
                  RequestedCatalogItemIds:
                    - rare_hat_7
                  AcceptedPlayerId: 461535E1EF4150A86889
                  AcceptedInventoryInstanceIds:
                    - 95C1797ADDAC24DC0383
                    - 0F7793DF55CCEAF21B84
                  OpenedAt: '2015-04-07T09:04:28+00:00'
                  FilledAt: '2015-04-07T09:20:53+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

- [Accept Trade](/services/playfab/api-references/rest/client/trading/accept-trade.md)
- [Trading](/services/playfab/economy-monetization/economy/trading/index.md)
- [Trading quickstart](/services/playfab/economy-monetization/economy/trading/trading-quickstart.md)
- [Using Player inventory](/services/playfab/player-progression/player-data/player-inventory.md)
- [Profile Writes Meter API Description](/services/playfab/pricing/meters/profile-writes.md)
