> ## 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 (sync)



## OpenAPI

````yaml /api-v2.json post /datasources/{datasource_id}/content/process
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: Artifact Schemas
    description: Agent artifact schema management
paths:
  /datasources/{datasource_id}/content/process:
    post:
      tags:
        - File Upload
      summary: Upload Content (sync)
      operationId: uploadAndListContent
      parameters:
        - name: datasource_id
          in: path
          required: true
          schema:
            type: string
            title: Datasource Id
        - name: trigger_ingest
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Start ingestion after upload completes. Returns ingest_url to poll
              for status.
            default: false
            title: Trigger Ingest
          description: >-
            Start ingestion after upload completes. Returns ingest_url to poll
            for status.
      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/FileUploadSyncResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            from meibel import MeibelClient

            client = MeibelClient(api_key="your-api-key")

            # Upload a file
            with open("document.pdf", "rb") as f:
                result = client.datasources.file_uploads.upload_and_list_content("datasource_id_value", file=f, filename="document.pdf")
                print(result)
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from 'meibel';


            const client = new MeibelClient({ apiKey: 'your-api-key' });


            import fs from 'fs';


            // Upload a file

            const file = fs.createReadStream('document.pdf');

            const result = await
            client.datasources.fileUploads.uploadAndListContent('datasource_id_value',
            file, 'document.pdf');

            console.log(result);
        - lang: Go
          label: Go
          source: >-
            import v2 "github.com/meibel-ai/meibel-go/v2"


            client := v2.NewClient(v2.WithAPIKey("your-api-key"))

            ctx := context.Background()


            // Upload a file

            f, err := os.Open("document.pdf")

            if err != nil {
                log.Fatal(err)
            }

            defer f.Close()


            result, err :=
            client.Datasources.FileUploads.UploadAndListContent(ctx,
            "datasource_id_value", f, "document.pdf", nil)

            if err != nil {
                log.Fatal(err)
            }

            fmt.Println(result)
components:
  schemas:
    FileUploadSyncResponse:
      properties:
        datasource_id:
          type: string
          title: Datasource Id
          description: ID of the datasource the files were uploaded to
        items:
          items:
            $ref: '#/components/schemas/ContentItem'
          type: array
          title: Items
          description: Content items present on the datasource after the upload completes
        continuation_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Continuation Token
          description: >-
            Set when the listing is truncated — pass to GET
            /datasources/{id}/content to fetch the rest
        ingest_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Ingest Url
          description: >-
            URL to poll for ingest status. Only set when `trigger_ingest=true`
            was supplied
      type: object
      required:
        - datasource_id
        - items
      title: FileUploadSyncResponse
      description: >-
        Result of a synchronous upload — waits until files are persisted,
        optionally triggers ingest, and returns the resulting content listing.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ContentItem:
      properties:
        name:
          type: string
          title: Name
          description: Filename
        path:
          type: string
          title: Path
          description: Object-storage path to the file relative to the datasource
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Object kind reported by storage (e.g. 'file', 'directory')
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
          description: File size in bytes
        media_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Type
          description: MIME type of the file
        last_modified:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Modified
          description: ISO 8601 timestamp of last modification in object storage
        etag:
          anyOf:
            - type: string
            - type: 'null'
          title: Etag
          description: Object-storage ETag for the file
      type: object
      required:
        - name
        - path
      title: ContentItem
      description: A single file in a datasource's content store.
    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

````