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

# Get Cloud Script Task Instance

> Get detail information about a CloudScript task instance.

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| ProductDisabledForTitle | 1609 |
| TaskInstanceNotFound | 1262 |




## OpenAPI

````yaml /services/playfab/api-references/rest/admin/admin.openapi.json post /Admin/GetCloudScriptTaskInstance
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/GetCloudScriptTaskInstance:
    post:
      tags:
        - ScheduledTask
      summary: Get Cloud Script Task Instance
      description: |
        Get detail information about a CloudScript task instance.

        ## Error codes

        This operation may return the following PlayFab errors:

        | Error | Code |
        | --- | --- |
        | ProductDisabledForTitle | 1609 |
        | TaskInstanceNotFound | 1262 |
      operationId: GetCloudScriptTaskInstance
      requestBody:
        $ref: '#/components/requestBodies/GetTaskInstanceRequest'
      responses:
        '200':
          $ref: '#/components/responses/GetCloudScriptTaskInstanceResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SecretKey: []
components:
  requestBodies:
    GetTaskInstanceRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GetTaskInstanceRequest'
      description: >-
        The result includes detail information that's specific to a CloudScript
        task. Only CloudScript tasks configured as "Run Cloud Script function
        once" will be retrieved. To get a list of task instances by task,
        status, or time range, use GetTaskInstances.
  responses:
    GetCloudScriptTaskInstanceResult:
      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/GetCloudScriptTaskInstanceResult'
            example:
              code: 200
              status: OK
              data:
                Summary:
                  TaskInstanceId: B67ACA247F49EF47-8
                  TaskIdentifier:
                    Name: EnableDailyHappyHour
                    Id: B67ACA247F49EF47
                  StartedAt: '2016-08-23T12:33:14'
                  CompletedAt: '2016-08-23T12:33:19'
                  Result:
                    Revision: 3
                    FunctionResult:
                      newScore: 25
                    Logs:
                      - Level: Info
                        Message: Something normal happened
                        Data:
                          secondsAfterStart: 75
                      - Level: Error
                        Message: Something unexpected happened
                    ExecutionTimeSeconds: 0.03670790046453476
                    MemoryConsumedBytes: 38904
                    APIRequestsIssued: 2
                Parameter:
                  FunctionName: applyStorePreset
                  Argument:
                    presetName: dailyHappyHour
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  schemas:
    GetTaskInstanceRequest:
      description: >-
        The result includes detail information that's specific to a CloudScript
        task. Only CloudScript tasks configured as "Run Cloud Script function
        once" will be retrieved. To get a list of task instances by task,
        status, or time range, use GetTaskInstances.
      type: object
      properties:
        TaskInstanceId:
          description: ID of the requested task instance.
          type: string
      required:
        - TaskInstanceId
      example:
        TaskInstanceId: E52531B47B1761C7-4
    GetCloudScriptTaskInstanceResult:
      type: object
      properties:
        Parameter:
          allOf:
            - $ref: '#/components/schemas/CloudScriptTaskParameter'
          description: Parameter of this task instance
        Summary:
          allOf:
            - $ref: '#/components/schemas/CloudScriptTaskSummary'
          description: Status summary of the CloudScript task instance
      example:
        Summary:
          TaskInstanceId: B67ACA247F49EF47-8
          TaskIdentifier:
            Name: EnableDailyHappyHour
            Id: B67ACA247F49EF47
          StartedAt: '2016-08-23T12:33:14'
          CompletedAt: '2016-08-23T12:33:19'
          Result:
            Revision: 3
            FunctionResult:
              newScore: 25
            Logs:
              - Level: Info
                Message: Something normal happened
                Data:
                  secondsAfterStart: 75
              - Level: Error
                Message: Something unexpected happened
            ExecutionTimeSeconds: 0.03670790046453476
            MemoryConsumedBytes: 38904
            APIRequestsIssued: 2
        Parameter:
          FunctionName: applyStorePreset
          Argument:
            presetName: dailyHappyHour
    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
    CloudScriptTaskParameter:
      type: object
      properties:
        Argument:
          description: Argument to pass to the CloudScript function.
          type: object
        FunctionName:
          description: Name of the CloudScript function to execute.
          type: string
      example:
        FunctionName: applyStorePreset
        Argument:
          presetName: dailyHappyHour
    CloudScriptTaskSummary:
      type: object
      properties:
        CompletedAt:
          description: UTC timestamp when the task completed.
          type: string
        EstimatedSecondsRemaining:
          description: Estimated time remaining in seconds.
          type: number
          x-actualtype: double
        PercentComplete:
          description: Progress represented as percentage.
          type: number
          x-actualtype: double
        Result:
          allOf:
            - $ref: '#/components/schemas/ExecuteCloudScriptResult'
          description: Result of CloudScript execution
        ScheduledByUserId:
          description: If manually scheduled, ID of user who scheduled the task.
          type: string
        StartedAt:
          description: UTC timestamp when the task started.
          type: string
        Status:
          allOf:
            - $ref: '#/components/schemas/TaskInstanceStatus'
          description: Current status of the task instance.
        TaskIdentifier:
          allOf:
            - $ref: '#/components/schemas/NameIdentifier'
          description: Identifier of the task this instance belongs to.
        TaskInstanceId:
          description: ID of the task instance.
          type: string
      required:
        - StartedAt
      example:
        TaskInstanceId: B67ACA247F49EF47-8
        TaskIdentifier:
          Name: EnableDailyHappyHour
          Id: B67ACA247F49EF47
        StartedAt: '2016-08-23T12:33:14'
        CompletedAt: '2016-08-23T12:33:19'
        Result:
          Revision: 3
          FunctionResult:
            newScore: 25
          Logs:
            - Level: Info
              Message: Something normal happened
              Data:
                secondsAfterStart: 75
            - Level: Error
              Message: Something unexpected happened
          ExecutionTimeSeconds: 0.03670790046453476
          MemoryConsumedBytes: 38904
          APIRequestsIssued: 2
    ExecuteCloudScriptResult:
      type: object
      properties:
        APIRequestsIssued:
          description: Number of PlayFab API requests issued by the CloudScript function
          type: number
          x-actualtype: int32
        Error:
          allOf:
            - $ref: '#/components/schemas/ScriptExecutionError'
          description: Information about the error, if any, that occurred during execution
        ExecutionTimeSeconds:
          type: number
          x-actualtype: double
        FunctionName:
          description: The name of the function that executed
          type: string
        FunctionResult:
          description: The object returned from the CloudScript function, if any
          type: object
        FunctionResultTooLarge:
          description: >-
            Flag indicating if the FunctionResult was too large and was
            subsequently dropped from this event. This only occurs if the total
            event size is larger than 350KB.
          type: boolean
        HttpRequestsIssued:
          description: Number of external HTTP requests issued by the CloudScript function
          type: number
          x-actualtype: int32
        Logs:
          description: >-
            Entries logged during the function execution. These include both
            entries logged in the function code using log.info() and log.error()
            and error entries for API and HTTP request failures.
          type: array
          items:
            $ref: '#/components/schemas/LogStatement'
          x-isclass: true
        LogsTooLarge:
          description: >-
            Flag indicating if the logs were too large and were subsequently
            dropped from this event. This only occurs if the total event size is
            larger than 350KB after the FunctionResult was removed.
          type: boolean
        MemoryConsumedBytes:
          type: number
          x-actualtype: uint32
        ProcessorTimeSeconds:
          description: >-
            Processor time consumed while executing the function. This does not
            include time spent waiting on API calls or HTTP requests.
          type: number
          x-actualtype: double
        Revision:
          description: The revision of the CloudScript that executed
          type: number
          x-actualtype: int32
      required:
        - Revision
        - ExecutionTimeSeconds
        - ProcessorTimeSeconds
        - MemoryConsumedBytes
        - APIRequestsIssued
        - HttpRequestsIssued
      example:
        Revision: 3
        FunctionResult:
          newScore: 25
        Logs:
          - Level: Info
            Message: Something normal happened
            Data:
              secondsAfterStart: 75
          - Level: Error
            Message: Something unexpected happened
        ExecutionTimeSeconds: 0.03670790046453476
        MemoryConsumedBytes: 38904
        APIRequestsIssued: 2
    TaskInstanceStatus:
      type: string
      enum:
        - Succeeded
        - Starting
        - InProgress
        - Failed
        - Aborted
        - Stalled
    NameIdentifier:
      description: >-
        Identifier by either name or ID. Note that a name may change due to
        renaming, or reused after being deleted. ID is immutable and unique.
      type: object
      properties:
        Id:
          description: Id Identifier, if present
          type: string
        Name:
          description: Name Identifier, if present
          type: string
      example:
        Name: MyTask
        Id: d739e188-22f6-4d13-a4d5-df2e93d4d2f7
    ScriptExecutionError:
      type: object
      properties:
        Error:
          description: >-
            Error code, such as CloudScriptNotFound, JavascriptException,
            CloudScriptFunctionArgumentSizeExceeded,
            CloudScriptAPIRequestCountExceeded, CloudScriptAPIRequestError, or
            CloudScriptHTTPRequestError
          type: string
        Message:
          description: Details about the error
          type: string
        StackTrace:
          description: >-
            Point during the execution of the script at which the error
            occurred, if any
          type: string
    LogStatement:
      type: object
      properties:
        Data:
          description: Optional object accompanying the message as contextual information
          type: object
        Level:
          description: '''Debug'', ''Info'', or ''Error'''
          type: string
        Message:
          type: string
  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

- [Get Cloud Script Task Instance](/services/playfab/api-references/rest/admin/scheduledtask/get-cloud-script-task-instance.md)
- [Run Task](/api-reference/scheduledtask/run-task.md)
- [Get Task Instances](/api-reference/scheduledtask/get-task-instances.md)
- [Get Actions On Players In Segment Task Instance](/api-reference/scheduledtask/get-actions-on-players-in-segment-task-instance.md)
- [Create Cloud Script Task](/api-reference/scheduledtask/create-cloud-script-task.md)
