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

# Attach Task

> Attach to a running task and receive its events as an SSE stream.



## OpenAPI

````yaml /api-reference/tasks.yaml get /tasks/{task_id}/attach
openapi: 3.1.0
info:
  title: Tasks
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /tasks/{task_id}/attach:
    get:
      tags:
        - Tasks
      summary: Attach Task
      description: Attach to a running task and receive its events as an SSE stream.
      operationId: attach_task_tasks__task_id__attach_get
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
      responses:
        '200':
          content:
            text/event-stream: {}
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Mobilerun from '@mobilerun/sdk';

            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });

            await client.tasks.attach('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            client.tasks.attach(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
components:
  schemas:
    ErrorResponse:
      properties:
        detail:
          description: The detail of the error
          title: Detail
          type: string
        errors:
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          description: The status code of the error
          title: Status
          type: integer
        title:
          description: The title of the error
          title: Title
          type: string
      required:
        - title
        - status
        - detail
        - errors
      title: ErrorResponse
      type: object
    UnauthorizedResponse:
      properties:
        detail:
          default: You are not authorized to access this resource
          description: The detail of the error
          title: Detail
          type: string
        errors:
          default: []
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          default: 401
          description: The status code of the error
          title: Status
          type: integer
        title:
          default: Unauthorized
          description: The title of the error
          title: Title
          type: string
      title: UnauthorizedResponse
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.