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

# Post Function Result For Player Triggered Action

> Generate a player PlayStream event for the provided function result.

Allowed entity token types: title



## OpenAPI

````yaml post /CloudScript/PostFunctionResultForPlayerTriggeredAction
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab CloudScript API
  description: API methods for executing CloudScript using an Entity Profile
  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: Server-Side Cloud Script
    description: Server-Side Cloud Script APIs
paths:
  /CloudScript/PostFunctionResultForPlayerTriggeredAction:
    post:
      tags:
        - Server-Side Cloud Script
      summary: Post Function Result For Player Triggered Action
      description: |-
        Generate a player PlayStream event for the provided function result.

        Allowed entity token types: title
      operationId: PostFunctionResultForPlayerTriggeredAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/PostFunctionResultForPlayerTriggeredActionRequest
      responses:
        '200':
          $ref: '#/components/responses/EmptyResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    PostFunctionResultForPlayerTriggeredActionRequest:
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        FunctionResult:
          allOf:
            - $ref: '#/components/schemas/ExecuteFunctionResult'
          description: The result of the function execution.
        PlayerProfile:
          allOf:
            - $ref: '#/components/schemas/PlayerProfileModel'
          description: The player profile the function was invoked with.
        PlayStreamEventEnvelope:
          allOf:
            - $ref: '#/components/schemas/PlayStreamEventEnvelopeModel'
          description: >-
            The triggering PlayStream event, if any, that caused the function to
            be invoked.
      required:
        - PlayerProfile
        - FunctionResult
      example:
        PlayStreamEventEnvelope:
          EntityId: 1234ABCD
          EntityType: title_player_account
          EventName: player_logged_in
          EventNamespace: com.playfab
          EventData: someeventdata
          EventSettings: someeventsettings
        PlayerProfile:
          TitleId: FFFF
          PlayerId: 1234ABCD
          Created: '2019-02-11T20:23:05'
          LastLogin: '2020-02-11T20:23:05'
          DisplayName: Gudge
        FunctionResult:
          ExecutionTimeMilliseconds: 367
          FunctionName: LevelCompleted
          FunctionResult:
            newScore: 25
          FunctionResultSize: 43
    ExecuteFunctionResult:
      type: object
      properties:
        Error:
          allOf:
            - $ref: '#/components/schemas/FunctionExecutionError'
          description: Error from the CloudScript Azure Function.
        ExecutionTimeMilliseconds:
          description: The amount of time the function took to execute
          type: number
          x-actualtype: int32
        FunctionName:
          description: The name of the function that executed
          type: string
        FunctionResult:
          description: The object returned from the function, if any
          type: object
        FunctionResultSize:
          description: The size in bytes of the object returned from the function, if any
          type: number
          x-actualtype: int32
        FunctionResultTooLarge:
          description: >-
            Flag indicating if the FunctionResult was too large and was
            subsequently dropped from this event.
          type: boolean
      required:
        - ExecutionTimeMilliseconds
      example:
        ExecutionTimeMilliseconds: 367
        FunctionName: LevelCompleted
        FunctionResult:
          newScore: 25
        FunctionResultSize: 43
    PlayerProfileModel:
      type: object
      properties:
        AdCampaignAttributions:
          description: List of advertising campaigns the player has been attributed to
          type: array
          items:
            $ref: '#/components/schemas/AdCampaignAttributionModel'
          x-isclass: true
        AvatarUrl:
          description: URL of the player's avatar image
          type: string
        BannedUntil:
          description: If the player is currently banned, the UTC Date when the ban expires
          type: string
        ContactEmailAddresses:
          description: List of all contact email info associated with the player account
          type: array
          items:
            $ref: '#/components/schemas/ContactEmailInfoModel'
          x-isclass: true
        Created:
          description: Player record created
          type: string
        DisplayName:
          description: Player display name
          type: string
        ExperimentVariants:
          description: >-
            List of experiment variants for the player. Note that these variants
            are not guaranteed to be up-to-date when returned during login
            because the player profile is updated only after login. Instead, use
            the LoginResult.TreatmentAssignment property during login to get the
            correct variants and variables.
          type: array
          items:
            type: string
        LastLogin:
          description: UTC time when the player most recently logged in to the title
          type: string
        LinkedAccounts:
          description: List of all authentication systems linked to this player account
          type: array
          items:
            $ref: '#/components/schemas/LinkedPlatformAccountModel'
          x-isclass: true
        Locations:
          description: >-
            List of geographic locations from which the player has logged in to
            the title
          type: array
          items:
            $ref: '#/components/schemas/LocationModel'
          x-isclass: true
        Memberships:
          description: List of memberships for the player, along with whether are expired.
          type: array
          items:
            $ref: '#/components/schemas/MembershipModel'
          x-isclass: true
        Origination:
          allOf:
            - $ref: '#/components/schemas/LoginIdentityProvider'
          description: Player account origination
        PlayerId:
          description: PlayFab player account unique identifier
          type: string
        PublisherId:
          description: Publisher this player belongs to
          type: string
        PushNotificationRegistrations:
          description: >-
            List of configured end points registered for sending the player push
            notifications
          type: array
          items:
            $ref: '#/components/schemas/PushNotificationRegistrationModel'
          x-isclass: true
        Statistics:
          description: List of leaderboard statistic values for the player
          type: array
          items:
            $ref: '#/components/schemas/StatisticModel'
          x-isclass: true
        Tags:
          description: List of player's tags for segmentation
          type: array
          items:
            $ref: '#/components/schemas/TagModel'
          x-isclass: true
        TitleId:
          description: Title ID this player profile applies to
          type: string
        TotalValueToDateInUSD:
          description: >-
            Sum of the player's purchases made with real-money currencies,
            converted to US dollars equivalent and represented as a whole number
            of cents (1/100 USD). For example, 999 indicates nine dollars and
            ninety-nine cents.
          type: number
          x-actualtype: uint32
        ValuesToDate:
          description: >-
            List of the player's lifetime purchase totals, summed by real-money
            currency
          type: array
          items:
            $ref: '#/components/schemas/ValueToDateModel'
          x-isclass: true
      example:
        TitleId: FFFF
        PlayerId: 1234ABCD
        Created: '2019-02-11T20:23:05'
        LastLogin: '2020-02-11T20:23:05'
        DisplayName: Gudge
    PlayStreamEventEnvelopeModel:
      type: object
      properties:
        EntityId:
          description: The ID of the entity the event is about.
          type: string
        EntityType:
          description: The type of the entity the event is about.
          type: string
        EventData:
          description: Data specific to this event.
          type: string
        EventName:
          description: The name of the event.
          type: string
        EventNamespace:
          description: The namespace of the event.
          type: string
        EventSettings:
          description: Settings for the event.
          type: string
    EmptyResult:
      type: object
      properties: {}
    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
    FunctionExecutionError:
      type: object
      properties:
        Error:
          description: >-
            Error code, such as
            CloudScriptAzureFunctionsExecutionTimeLimitExceeded,
            CloudScriptAzureFunctionsArgumentSizeExceeded,
            CloudScriptAzureFunctionsReturnSizeExceeded or
            CloudScriptAzureFunctionsHTTPRequestError
          type: string
        Message:
          description: Details about the error
          type: string
        StackTrace:
          description: >-
            Point during the execution of the function at which the error
            occurred, if any
          type: string
    AdCampaignAttributionModel:
      type: object
      properties:
        AttributedAt:
          description: UTC time stamp of attribution
          type: string
        CampaignId:
          description: Attribution campaign identifier
          type: string
        Platform:
          description: Attribution network name
          type: string
      required:
        - AttributedAt
    ContactEmailInfoModel:
      type: object
      properties:
        EmailAddress:
          description: The email address
          type: string
        Name:
          description: The name of the email info data
          type: string
        VerificationStatus:
          allOf:
            - $ref: '#/components/schemas/EmailVerificationStatus'
          description: The verification status of the email
    LinkedPlatformAccountModel:
      type: object
      properties:
        Email:
          description: Linked account email of the user on the platform, if available
          type: string
        Platform:
          allOf:
            - $ref: '#/components/schemas/LoginIdentityProvider'
          description: Authentication platform
        PlatformUserId:
          description: Unique account identifier of the user on the platform
          type: string
        Username:
          description: Linked account username of the user on the platform, if available
          type: string
    LocationModel:
      type: object
      properties:
        City:
          description: City name.
          type: string
        ContinentCode:
          allOf:
            - $ref: '#/components/schemas/ContinentCode'
          description: The two-character continent code for this location
        CountryCode:
          allOf:
            - $ref: '#/components/schemas/CountryCode'
          description: >-
            The two-character ISO 3166-1 country code for the country associated
            with the location
        Latitude:
          description: Latitude coordinate of the geographic location.
          type: number
          x-actualtype: double
        Longitude:
          description: Longitude coordinate of the geographic location.
          type: number
          x-actualtype: double
    MembershipModel:
      type: object
      properties:
        IsActive:
          description: >-
            Whether this membership is active. That is, whether the
            MembershipExpiration time has been reached.
          type: boolean
        MembershipExpiration:
          description: The time this membership expires
          type: string
        MembershipId:
          description: The id of the membership
          type: string
        OverrideExpiration:
          description: >-
            Membership expirations can be explicitly overridden (via game
            manager or the admin api). If this membership has been overridden,
            this will be the new expiration time.
          type: string
        OverrideIsSet:
          description: Whether the override expiration is set.
          type: boolean
          x-GovernsProperty: OverrideExpiration
        Subscriptions:
          description: The list of subscriptions that this player has for this membership
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionModel'
          x-isclass: true
      required:
        - MembershipExpiration
        - IsActive
    LoginIdentityProvider:
      type: string
      enum:
        - Unknown
        - PlayFab
        - Custom
        - GameCenter
        - GooglePlay
        - Steam
        - XBoxLive
        - PSN
        - Kongregate
        - Facebook
        - IOSDevice
        - AndroidDevice
        - Twitch
        - WindowsHello
        - GameServer
        - CustomServer
        - NintendoSwitch
        - FacebookInstantGames
        - OpenIdConnect
        - Apple
        - NintendoSwitchAccount
        - GooglePlayGames
        - XboxMobileStore
        - King
        - BattleNet
    PushNotificationRegistrationModel:
      type: object
      properties:
        NotificationEndpointARN:
          description: Notification configured endpoint
          type: string
        Platform:
          allOf:
            - $ref: '#/components/schemas/PushNotificationPlatform'
          description: Push notification platform
    StatisticModel:
      type: object
      properties:
        Name:
          description: Statistic name
          type: string
        Value:
          description: Statistic value
          type: number
          x-actualtype: int32
        Version:
          description: Statistic version (0 if not a versioned statistic)
          type: number
          x-actualtype: int32
      required:
        - Version
        - Value
    TagModel:
      type: object
      properties:
        TagValue:
          description: Full value of the tag, including namespace
          type: string
    ValueToDateModel:
      type: object
      properties:
        Currency:
          description: ISO 4217 code of the currency used in the purchases
          type: string
        TotalValue:
          description: >-
            Total value of the purchases in a whole number of 1/100 monetary
            units. For example, 999 indicates nine dollars and ninety-nine cents
            when Currency is 'USD')
          type: number
          x-actualtype: uint32
        TotalValueAsDecimal:
          description: >-
            Total value of the purchases in a string representation of decimal
            monetary units. For example, '9.99' indicates nine dollars and
            ninety-nine cents when Currency is 'USD'.
          type: string
      required:
        - TotalValue
    EmailVerificationStatus:
      type: string
      enum:
        - Unverified
        - Pending
        - Confirmed
    ContinentCode:
      type: string
      enum:
        - AF
        - AN
        - AS
        - EU
        - NA
        - OC
        - SA
        - Unknown
    CountryCode:
      type: string
      enum:
        - AF
        - AX
        - AL
        - DZ
        - AS
        - AD
        - AO
        - AI
        - AQ
        - AG
        - AR
        - AM
        - AW
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BM
        - BT
        - BO
        - BQ
        - BA
        - BW
        - BV
        - BR
        - IO
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - CV
        - KY
        - CF
        - TD
        - CL
        - CN
        - CX
        - CC
        - CO
        - KM
        - CG
        - CD
        - CK
        - CR
        - CI
        - HR
        - CU
        - CW
        - CY
        - CZ
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - ET
        - FK
        - FO
        - FJ
        - FI
        - FR
        - GF
        - PF
        - TF
        - GA
        - GM
        - GE
        - DE
        - GH
        - GI
        - GR
        - GL
        - GD
        - GP
        - GU
        - GT
        - GG
        - GN
        - GW
        - GY
        - HT
        - HM
        - VA
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IR
        - IQ
        - IE
        - IM
        - IL
        - IT
        - JM
        - JP
        - JE
        - JO
        - KZ
        - KE
        - KI
        - KP
        - KR
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MO
        - MK
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MQ
        - MR
        - MU
        - YT
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MS
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - NC
        - NZ
        - NI
        - NE
        - NG
        - NU
        - NF
        - MP
        - 'NO'
        - OM
        - PK
        - PW
        - PS
        - PA
        - PG
        - PY
        - PE
        - PH
        - PN
        - PL
        - PT
        - PR
        - QA
        - RE
        - RO
        - RU
        - RW
        - BL
        - SH
        - KN
        - LC
        - MF
        - PM
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SX
        - SK
        - SI
        - SB
        - SO
        - ZA
        - GS
        - SS
        - ES
        - LK
        - SD
        - SR
        - SJ
        - SZ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TZ
        - TH
        - TL
        - TG
        - TK
        - TO
        - TT
        - TN
        - TR
        - TM
        - TC
        - TV
        - UG
        - UA
        - AE
        - GB
        - US
        - UM
        - UY
        - UZ
        - VU
        - VE
        - VN
        - VG
        - VI
        - WF
        - EH
        - YE
        - ZM
        - ZW
        - Unknown
    SubscriptionModel:
      type: object
      properties:
        Expiration:
          description: When this subscription expires.
          type: string
        InitialSubscriptionTime:
          description: The time the subscription was orignially purchased
          type: string
        IsActive:
          description: >-
            Whether this subscription is currently active. That is, if
            Expiration > now.
          type: boolean
        Status:
          allOf:
            - $ref: '#/components/schemas/SubscriptionProviderStatus'
          description: >-
            The status of this subscription, according to the subscription
            provider.
        SubscriptionId:
          description: The id for this subscription
          type: string
        SubscriptionItemId:
          description: The item id for this subscription from the primary catalog
          type: string
        SubscriptionProvider:
          description: >-
            The provider for this subscription. Apple or Google Play are
            supported today.
          type: string
      required:
        - Expiration
        - IsActive
        - InitialSubscriptionTime
    PushNotificationPlatform:
      type: string
      enum:
        - ApplePushNotificationService
        - GoogleCloudMessaging
    SubscriptionProviderStatus:
      type: string
      enum:
        - NoError
        - Cancelled
        - UnknownError
        - BillingError
        - ProductUnavailable
        - CustomerDidNotAcceptPriceChange
        - FreeTrial
        - PaymentPending
  responses:
    EmptyResult:
      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/EmptyResult'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    EntityToken:
      type: apiKey
      in: header
      name: X-EntityToken
      description: >-
        This API requires an Entity Session Token, available from the Entity
        GetEntityToken method.

````

## Related topics

- [Post Function Result For Player Triggered Action](/api-reference/server-side-cloud-script/post-function-result-for-player-triggered-action.md)
- [Post Function Result For Entity Triggered Action](/api-reference/server-side-cloud-script/post-function-result-for-entity-triggered-action.md)
- [player_triggered_action_executed_function](/services/playfab/api-references/events/Functions/player-triggered-action-executed-function.md)
- [player_triggered_action_executed_cloudscript](/services/playfab/api-references/events/CloudScript/player-triggered-action-executed-cloudscript.md)
- [player_action_executed](/services/playfab/api-references/events/Player/player-action-executed.md)
