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

# Stream Download Progress



## OpenAPI

````yaml /api-v2.json get /datasources/{datasource_id}/downloads/{job_id}/progress
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Execution Policies
    description: Data access and tool usage constraints scoped to agent sessions
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /datasources/{datasource_id}/downloads/{job_id}/progress:
    get:
      tags:
        - Datasource Downloads
      summary: Stream Download Progress
      operationId: streamDownloadProgress
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
        - name: datasource_id
          in: path
          required: true
          schema:
            type: string
            title: Datasource Id
      responses:
        '200':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            import os
            from meibel import MeibelClient

            client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])

            stream = client.datasources.downloads.stream_progress(
                datasource_id="ds_9f8a3b2c1d0e",
                job_id="job_4e2a1c8b7f6d",
            )

            for event in stream:
                if event.event == "connected":
                    print("Connected to progress stream")
                elif event.event == "progress":
                    payload = event.json()
                    print(f"Progress: {payload}")
                elif event.event == "stream_complete":
                    print("Download progress stream complete")
                    break
                elif event.event == "error":
                    payload = event.json()
                    print(f"Error: {payload}")
                    break
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from "meibel";


            const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY
            });


            const stream = await client.datasources.downloads.streamProgress({
              datasourceId: "ds_8f3a2b1c",
              jobId: "job_4c9d7e21",
            });


            for await (const event of stream) {
              switch (event.event) {
                case "connected":
                  console.log(`Connected: ${event.data}`);
                  break;
                case "progress":
                  console.log(`Progress update: ${JSON.stringify(event.data)}`);
                  break;
                case "stream_complete":
                  console.log("Download stream complete");
                  break;
                case "error":
                  console.error(`Stream error: ${JSON.stringify(event.data)}`);
                  break;
              }
            }
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tv2 \"github.com/meibel-ai/meibel-go/v2\"\n)\n\nfunc main() {\n\tclient := v2.NewClient(v2.WithAPIKey(os.Getenv(\"MEIBEL_API_KEY\")))\n\n\tstream, err := client.Datasources.Downloads.StreamProgress(\n\t\tcontext.Background(),\n\t\t\"ds_8f3a2b1c9d0e\",\n\t\t\"job_4d7e1f9c2a3b\",\n\t)\n\tif err != nil {\n\t\tfmt.Println(\"error starting stream:\", err)\n\t\treturn\n\t}\n\n\tfor event := range stream.Events() {\n\t\tswitch e := event.(type) {\n\t\tcase v2.ConnectedEvent:\n\t\t\tfmt.Println(\"connected:\", e.Data)\n\t\tcase v2.ProgressEvent:\n\t\t\tfmt.Println(\"progress update received\")\n\t\tcase v2.StreamCompleteEvent:\n\t\t\tfmt.Println(\"download stream complete\")\n\t\tcase v2.ErrorEvent:\n\t\t\tfmt.Println(\"stream reported an error\")\n\t\t}\n\t}\n\n\tif err := <-stream.Errors(); err != nil {\n\t\tfmt.Println(\"stream error:\", err)\n\t}\n}"
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````