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

# Submit Upload Job with local files



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml post /v4/knowledge-bases/{knowledge_base_id}/upload_files
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/knowledge-bases/{knowledge_base_id}/upload_files:
    post:
      tags:
        - Knowledge Bases
      summary: Submit Upload Job with local files
      operationId: POST-V4-/knowledge-bases/{knowledge_base_id}/upload_files
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Base Id
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_POST-V4-_knowledge-bases__knowledge_base_id__upload_files
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CreateKnowledgeBaseV2UploadsFromFilesResponse
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          source: >-
            import os

            from scale_gp import SGPClient


            client = SGPClient(
                api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
            )

            create_knowledge_base_uploads_from_files_response =
            client.knowledge_bases.upload_files(
                knowledge_base_id="knowledge_base_id",
                chunking_strategy_config="chunking_strategy_config",
                data_source_config="data_source_config",
                files=["string"],
                force_reupload=True,
            )

            print(create_knowledge_base_uploads_from_files_response.upload_ids)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/sgp-go\"\n\t\"github.com/stainless-sdks/sgp-go/option\"\n)\n\nfunc main() {\n\tclient := sgp.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcreateKnowledgeBaseUploadsFromFilesResponse, err := client.KnowledgeBases.UploadFiles(\n\t\tcontext.TODO(),\n\t\t\"knowledge_base_id\",\n\t\tsgp.KnowledgeBaseUploadFilesParams{\n\t\t\tChunkingStrategyConfig: sgp.F(\"chunking_strategy_config\"),\n\t\t\tDataSourceConfig:       sgp.F(\"data_source_config\"),\n\t\t\tFiles:                  sgp.F([]string{\"string\"}),\n\t\t\tForceReupload:          sgp.F(true),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", createKnowledgeBaseUploadsFromFilesResponse.UploadIDs)\n}\n"
components:
  schemas:
    Body_POST-V4-_knowledge-bases__knowledge_base_id__upload_files:
      properties:
        files:
          items:
            type: string
            contentMediaType: application/octet-stream
          type: array
          title: Files
        data_source_config:
          type: string
          title: Data Source Config
        chunking_strategy_config:
          type: string
          title: Chunking Strategy Config
        force_reupload:
          title: Force Reupload
          type: boolean
        tagging_information:
          title: Tagging Information
          type: string
        custom_metadata:
          title: Custom Metadata
          description: >-
            JSON-encoded dictionary of custom metadata to attach to all chunks
            generated from the uploaded files. These metadata fields become
            queryable via metadata_filters on the chunks query endpoint.
          type: string
      type: object
      required:
        - files
        - data_source_config
        - chunking_strategy_config
        - force_reupload
      title: Body_POST-V4-/knowledge-bases/{knowledge_base_id}/upload_files
    CreateKnowledgeBaseV2UploadsFromFilesResponse:
      properties:
        upload_ids:
          items:
            type: string
          type: array
          title: Upload Ids
          description: List of upload IDs that have been kicked off by the upload API
      type: object
      required:
        - upload_ids
      title: CreateKnowledgeBaseV2UploadsFromFilesResponse
    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
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````