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

# Upload Content (async)



## OpenAPI

````yaml /api-v2.json post /datasources/{datasource_id}/content
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}/content:
    post:
      tags:
        - File Upload
      summary: Upload Content (async)
      operationId: uploadContent
      parameters:
        - name: datasource_id
          in: path
          required: true
          schema:
            type: string
            title: Datasource Id
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - files
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: One or more files to upload
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadContentResponse'
        '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"])

            with open("product_manual.pdf", "rb") as file:
                response = client.datasources.file_uploads.upload_content(
                    datasource_id="ds_abc123",
                    file=file,
                )

            print(f"{response.message} (upload_id={response.upload_id})")
            print(f"Stream progress at: {response.sse_url}")
        - lang: TypeScript
          label: TypeScript
          source: >-
            import fs from "fs";

            import { MeibelClient } from "meibel";


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


            const response = await client.datasources.fileUploads.uploadContent(
              "ds_8f3a2b1c9d4e",
              {
                file: fs.createReadStream("./quarterly-report.pdf"),
              }
            );


            console.log(`${response.message} (upload_id:
            ${response.upload_id})`);

            console.log(`Stream progress at: ${response.sse_url}`);
        - 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\tresp, err := client.Datasources.FileUploads.UploadContent(\n\t\tcontext.Background(),\n\t\t\"datasource_abc123\",\n\t\tv2.BodyUploadContent{},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Upload accepted: %s (upload_id: %s)\\n\", resp.Message, resp.UploadId)\n\tfmt.Printf(\"Track progress via SSE: %s\\n\", resp.SseUrl)\n}"
components:
  schemas:
    UploadContentResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: True if the upload was accepted for processing
        message:
          type: string
          title: Message
          description: Human-readable status message
        datasource_id:
          type: string
          title: Datasource Id
          description: >-
            ID of the datasource the files were uploaded to (created on the fly
            if `name` was supplied)
        upload_id:
          type: string
          title: Upload Id
          description: >-
            Identifier for this upload batch — use with the SSE stream to track
            progress
        sse_url:
          type: string
          title: Sse Url
          description: >-
            Server-sent-events URL to stream upload progress until
            'stream_complete'
        estimated_files:
          anyOf:
            - type: integer
            - type: 'null'
          title: Estimated Files
          description: Number of files the server expects to process for this upload
        estimated_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Estimated Size
          description: Total estimated size of the upload in bytes
      type: object
      required:
        - success
        - message
        - datasource_id
        - upload_id
        - sse_url
      title: UploadContentResponse
      description: >-
        Result of an async upload — files are accepted and streamed
        asynchronously.
    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

````